Abort on ambiguous subcommand names #629
Closed
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.
Currently it's possible to have two commands with the same _commandName by mixing a combination of the automatic command name generation based on the type name, and explicit use of
CommandConfiguration
's commandName parameter. For example, if we edit the math examplesAdd
command to have a commandName of "multiply" this is allowed currently:The behavior today is whatever subcommand is registered in the tree first is what will resolve for that command. So,
Multiply
in this example is permanently shadowed.This change just makes sure there's no occurence of this happening in any level of the tree of potential subcommands, and if so we'll abort early.
Note
I can't imagine this happens too often, but the detection logic will also be useful to verify clashing aliases+subcommands for this change as well #627.
Checklist