I want to create an optional argument, which will be the '-- '
(double dash and a space) and get everything after it as its value. The problem is that some other optional arguments might appear after '-- '
. I don't want these to be parsed as optional arguments, but as the values of '-- '
. For example:
python prog1 --foo 1 --bar 2
Here foo
and bar
are optional arguments with values 1
and 2
respectively
python prog1 --foo 1 --bar 2 -- --foo 4 --bar 14
Here I want foo
and bar
that come before '-- '
to be parsed as optional arguments. But I want '--foo 4 --bar 14'
to be parsed as the value of the optional argument '-- '
. I would like to do this without renaming the parameters that come after '-- '
to foo2
and bar2
, if possible.
So is this possible? And how could this be implemented?