Is there any way in argparse to parse flags like [+-]a,b,c,d
?
foo.py +s -b
should store True in the dest
of s
and False in the dest
of b
, much like done by the Windows attrib
or the Linux chmod
.
Currently, I am using 2 separate arguments +s
and -s
with store_true
and store_false
, respectively. But it creates an ugly help with it listing each flag twice (+a & -a)
Another workaround would be to manually parse the extended arg with regex (which somehow seems a lot easier and use custom description, but before doing that I just wanted to look around if there was anything using which I could perform the same thing using argparse itself.