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.
Hi,
This patch changes the way that globaloptions are merged into opts. The result is that options can use '-h' in the obvious way (see the test script) without disabling '--help'. This should fix GH-2.
The old behaviour was to refuse to include any global option if either its long or short name conflicted with another option. The result of this is that an option with short name '-h' would prevent the help option from being added to the command (I didn't get the stacktrace reported in GH-2).
With this patch the new behaviour is to refuse to include a global option if its long name matches any local option (since these are definitely not compatible). If the short name matches, then the short name is used for the local option. This means that if an option declares '-h', then '--help' will still be available but '-h' will refer to the new option.
In the general case when using dispatch this behaviour could lead to unexpected results where for example the short name for a global option would have a different meaning in some subcommands. However, if someone is overriding the short name of a global option in a local option I can't see what other behaviour they should expect.
Thanks,
Oscar.