refactor: move option parsing into common.wrap()#479
Merged
Conversation
|
|
||
| ### head([{'-n', \<num\>},] file [, file ...]) | ||
| ### head([{'-n', \<num\>},] file_array) | ||
| Available options: |
Contributor
There was a problem hiding this comment.
Why these changes? They seem unrelated.
Member
Author
There was a problem hiding this comment.
@ariporad As I was digging through, I saw that the documentation had an error (it was missing the available option). You're correct, these changes are unrelated to the refactor.
Contributor
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is roughly in-line with what was proposed for the plugin API. This moves option parsing as part of
common.wrap(), so contributors don't need to worry about making the call themselves. By default,common.wrap()acts as it did before, and will only parse options if options are specified when the plugin is registered.For trickier commands, like
chmod()andset(), which sometimes need special parsing, the contributor can choose to parse these commands with an explicit call tocommon.parseOptions().This deviates from the plugin API draft in that command options are passed in via the
cmdOptionsattribute, which I believe is more descriptive than an anonymous parameter tocommon.register(). This also makes it easier to leave option parsing optional.