feat: adds alias for the kebab cases of the original targets.#441
feat: adds alias for the kebab cases of the original targets.#441jcchavezs wants to merge 3 commits intomagefile:masterfrom
Conversation
Most of the experience in make is around chaining targets using kebab case e.g. make build test e2e-test which isn't supported by mage. This change automatically adds alias for the kebabcase version of the targets if they don't exist.
|
The problem with this is that the mage list output text can only really show one form. I don’t really want to support configurations to generate different names, since then we get into configuration hell. I would be in favor of showing aliases in the help docs (I can’t remember if they get shown in the full command docs (i.e. mage -h but if they’re not, then I think that would be good. I don’t like replacing the default generated command name with the alias in the help docs, because an alias is, by definition, an alternate name. it’s a way to make a script still work with the old name. And I’m not a huge fan of generating kebab case targets automatically, because that’s a fairly significant change in behavior that could have unintended side effects on other people’s magefiles. It also really only applies to a very small use case, and has a straightforward work around (i.e. add the aliases manually). |
|
Thanks for the feedback @natefinch! So to be clear, are you fine with autogenerated aliases (notice we don't override user defined aliases if they exist under the kebab-case name) and display the aliases in the help command? I think that is fine, I wouldn't replace the original commands as magic is always confusing. |
| continue | ||
| } | ||
|
|
||
| if _, ok := newAliases[f.Name]; !ok { |
There was a problem hiding this comment.
We don't replace existing aliases.
Most of the experience in make is around chaining targets using kebab case e.g. make build test e2e-test which isn't supported by mage. This change automatically adds alias for the kebabcase version of the targets if they don't exist.
Closes #311