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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor!: rework results to have parsedOptions property and store true in values for boolean options #80
refactor!: rework results to have parsedOptions property and store true in values for boolean options #80
Changes from all commits
d414a7b
f53e230
877b0ce
e355fd5
d12e027
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems wrong; — means “stop parsing options”; everything after it should be untouched.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you mean.
The QA don't include an example storing an (otherwise) option as a positional, is that what you were expecting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What i mean is,
program a b c
should have three positionals (a, b, and c) - butprogram -- a b c
should only have one positional, the string "a b c", so it can be passed verbatim to something else.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, combining the strings like that would lose the information about the separate arguments and require another interpretation step to split them up again.
This might be too opaque, but imagine implementing subcommands:
A different example. The
--
turns off option processing and the remaining arguments end up untouched and treated as positionals, so these three examples all have the same result. There isn't anything special about the handling of arguments after the--
than before the--
other than no option processing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's the idea. They're going to be passed to another program, so THAT program will be interpreting them on its own - perhaps with different rules than the current one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally that other program will be interpreting an array of arguments, not a single string?
The
--
stops option detection. It is not a marker for separate collection of arguments into another structure.(There are some programs that treat
--
as a marker for separate processing, but in my experience that is unusual. It is easy to form the impression programs work that way though, since for easy reading the--
is often put before the passthrough arguments!)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One way of thinking about
--
is that it is another user-level intervention. No author action required.--
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example behaviours of reference implementations added to: #58 (comment)