Add support for help groups for options #2176
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.
Pull Request
Problem
See: #1897
Related PR: #1908 #1910
Solution
This is a proof of concept adding a map of group titles to the Help configuration. This sort of mapping has some advantages compared with adding a group property to each Option:
help
andversion
without needing to create custom OptionsHowever, directly supplying the map does not feel very Commander-like. Adding a method on Command to add a single option group at a time might be more in the chaining style while retaining the practical advantages. Adding a group property to the Option would be more object-oriented, and other libraries allow this (#1897 (comment)).
Playing with the idea partly to think about how Help could be refactored to make this more feasible to implement with an author supplied override.
Example use: