[#2104] Usage shows alias used rather than command name #2105
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First attempt at a fix for #2104
Looking at repeatable subcommands gave me the inspiration for this PR - for repeatable subcommands there seems to be some copying of
CommandLine
and so this PR takes a similar approach: When a subcommand alias is used, theCommandLine
is copied with name and alias swapped.I imagine the need for additional
CommandLine
instances here might be seen as a hack. And I suspect there's potentially some mileage in adding aparsedName
field rather swapping alias/name. But I figure this was worth getting feedback on.Yeah, I was surprised the
CommandLine
doesn't retain access to theParseResult
. I've tried to avoid resorting to static stuff for now, but can see that could be necessary.Presumably the PR could cause some side effects here with the
CommandLine
name having changed. I guess the new behaviour could be hidden behind some new optional flag. Although I'm not sure where best that option would fit off the top of my head.