bpo-14191 Add parse_intermixed_args.#3319
Merged
bitdancer merged 5 commits intopython:masterfrom Sep 7, 2017
Merged
Conversation
Member
|
Looks reasonable to me, but Travis is unhappy with the docs change. |
0a178e1 to
573a9ce
Compare
warsaw
approved these changes
Sep 6, 2017
Member
warsaw
left a comment
There was a problem hiding this comment.
Just a few comments. Fix or ignore and land it!
Doc/library/argparse.rst
Outdated
| .. method:: ArgumentParser.parse_intermixed_args(args=None, namespace=None) | ||
| .. method:: ArgumentParser.parse_known_intermixed_args(args=None, namespace=None) | ||
|
|
||
| A number of unix commands allow the user to intermix optional arguments with |
Doc/library/argparse.rst
Outdated
| >>> parser.add_argument('--foo') | ||
| >>> parser.add_argument('cmd') | ||
| >>> parser.add_argument('rest', nargs='*', type=int) | ||
| >>> parser.parse_known_args('cmd1 1 --foo bar 2 3'.split()) |
Member
There was a problem hiding this comment.
It says cmd above, but cmd1 here and below. Is that intentional?
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 adds support for parsing a command line where options and positionals are intermixed as is common in many unix commands. This is paul.j3's patch with a few tweaks.
https://bugs.python.org/issue14191