Bug Description
When running mage <TAB> against magefiles that have mg.Namespace defined, mage completion incorrectly handles : in the target names, e.g. :
> mage -l
Targets:
fmt formats Go code using gofmt.
migration:create creates a timestamped SQL migration.
migration:down rolls back one migration.
migration:status prints migration status.
migration:up applies pending migrations.
migration:validate validates migration files without changing a database.
sqlc:diff reports whether generated query code differs from checked-in code.
sqlc:generate regenerates database query code from migrations and named queries.
sqlc:vet checks SQL queries for errors.
> mage <TAB>
migration -- create
sqlc -- diff
build checkfmt ci clean fix fmt install lint test vet
What did you do?
type Migration mg.Namespace
func (Migration) Create() {}
func (Migration) Down() {}
func (Migration) Up() {}
...
What did you expect to happen?
I was expecting tab completion to produce this instead (newlines vs. spaces notwithstanding):
> mage <TAB>
migration:create
migration:down
migration:status
migration:up
migration:validate
sqlc:diff
sqlc:generate
sqlc:vet
build checkfmt ci clean fix fmt install lint test vet
What actually happened?
The first target of each mg.Namespace becomes the zsh description of that namespace. All the other targets are dropped. When you type mage migration:cr<TAB>, it doesn't complete it either:
> mage <TAB>
migration -- create
sqlc -- diff
build checkfmt ci clean fix fmt install lint test vet
Environment
Mage Build Tool v1.17.2
Build Date: 2026-04-22T22:57:48Z
Commit: 0953947c1673fd745a51c032aadeb3c63f9f3368
built with: go1.26.2
Additional context
I've only tested this in zsh, but let me know if you want me to provide examples for bash,fish etc.
Bug Description
When running
mage <TAB>againstmagefilesthat havemg.Namespacedefined,magecompletion incorrectly handles:in the target names, e.g. :What did you do?
What did you expect to happen?
I was expecting tab completion to produce this instead (newlines vs. spaces notwithstanding):
What actually happened?
The first target of each
mg.Namespacebecomes thezshdescription of that namespace. All the other targets are dropped. When you typemage migration:cr<TAB>, it doesn't complete it either:Environment
macOSAdditional context
I've only tested this in
zsh, but let me know if you want me to provide examples forbash,fishetc.