Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds alias for the kebab cases of the original targets. #441

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jcchavezs
Copy link

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

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.
@natefinch
Copy link
Member

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).

@jcchavezs
Copy link
Author

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 {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't replace existing aliases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better support for kebab-case targets
2 participants