How to use argparse to collect arguments for a separate command line without --?
I'm writing Python programs that run other programs, like:
my-wrapper-program --foo --bar git commit --all
Here, foo and bar are arguments to my-wrapper-program, and git commit --all
is the sub-command I'm interested in running. How do I do this in argparse, without having to always specify the --
special开发者_如何转开发 argument? (The common case is the simplest one: my-wrapper-program command
.)
(With optparse, you can use disallow_interspersed_args=False
.)
This page has some suggestions.
精彩评论