-
Notifications
You must be signed in to change notification settings - Fork 425
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
Displaying command alias in help/usage #2104
Comments
Hi @roxspring thank you for raising this! No you haven't overlooked anything, currently the help is the same regardless of which alias was used to invoke it. Some thoughts:
It may not be easy to build bookkeeping to keep track of this. Such bookkeeping also needs to handle scenarios like nested sub-subcommands and repeatable subcommands. Secondly, the display part. Currently help is static: it's not designed to change depending on user input (only the error message is, but that isn't part of the usage help message). There's no parser state available to the logic that constructs the usage help message. I imagine we would have to use a static variable (or something similar) to store the user-specified command name/alias, to make that alias available to the logic that constructs the usage help message. If you can think of a better solution, ideas are welcome! Finally, the help is designed to be highly customizable. If applications have tests that assert the exact help message, then these tests may break, that's unavoidable. But other than that, any changes we introduce here should not impact other applications who have customized their help message, those customizations should continue to work as before. |
Reading the description for this ticket again it’s clear the alias is for a subcommand. Apologies, I didn’t read carefully. I edited my previous comment. |
Looking at repeatable subcommands gave me the inspiration for #2105 - arguably a bit hacky so feedback welcome! |
We have two steps that users perform which are conceptually very different, but technically identical. We define each step as a separate command, and so we've implemented these technically identical steps as a single
step1
command with astep2
alias. Technically this works well, but it's a little confusing to ask for help forstep2
and get shown help apparently forstep1
.Given a subcommand with an alias, is it possible to have that alias used in the help/usage?
If it's already possible, I'd love to understand what I'm missing.
If not, and it's welcome, then I'm happy to take recommendations how to implement it and submit a PR!
The text was updated successfully, but these errors were encountered: