-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-14191 Add parse_intermixed_args. #3319
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
Conversation
Looks reasonable to me, but Travis is unhappy with the docs change. |
0a178e1
to
573a9ce
Compare
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.
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 |
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.
Unix perhaps?
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()) |
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.
It says cmd
above, but cmd1
here and below. Is that intentional?
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