docs
cli
overview
CLI Overview
CLI Overview
Mithril provides a global CLI (mithril) and project commands that delegate to make.
Global Commands#
mithril --version # Show version (alias: version, ping)
mithril init # Symlink CLI to /usr/local/bin
mithril new <name> # Scaffold new project (git clone + setup)
mithril help # Usage
Project Commands#
Inside a Mithril project (detected by go.mod + Makefile), any make target works:
cd my-app
mithril run
mithril run-dev
mithril migrate-up
mithril crud MODEL=Blog
mithril seed
mithril createsuperuser
mithril backup
mithril swagger
mithril admin-enable
mithril dbms
Equivalent to ./mithril <target> or make <target>.
Development#
| Command | Description |
|---|---|
mithril install | go mod tidy && go mod download |
mithril run | go run . |
mithril run-dev | Air live reload |
mithril build | go build -o bin/app . |
mithril test | go test -v ./... |
mithril routes | Print registered routes |
mithril kill | Stop dev server / Air |
Database#
| Command | Description |
|---|---|
mithril migrate-up | Apply goose migrations |
mithril migrate-down | Roll back one migration |
mithril migrate-status | Migration status |
mithril migrate-reset | Reset DB (destructive) |
mithril seed | Run seed data |
mithril backup | Database backup |
mithril restore | Restore from backup |
mithril backup-list | List backups |
Code Generation#
mithril crud MODEL=User
go run ./cmd/crud --dry-run Blog
ACL#
mithril acl-role-create NAME=editor
mithril acl-permission-create NAME=blogs.view
mithril acl-assign-role EMAIL=user@example.com ROLE=editor
mithril acl-superuser-set EMAIL=admin@example.com
Run make acl for full ACL help.
Utilities#
mithril secret # Generate random secret
mithril hash TEXT=password # bcrypt hash
mithril sha256 TEXT=hello
mithril encode TEXT=hello # Base64 encode
mithril decode TEXT=aGVsbG8= # Base64 decode
Admin & DBMS#
mithril admin-enable / admin-disable
mithril dbms-enable / dbms-disable
mithril dbms # Start embedded DBMS on :5050
Install Script#
curl -fsSL https://raw.githubusercontent.com/mithril-framework/mithril/main/install.sh | sh