argparse and subparsers

Joseph L. Casale jcasale at activenetwerx.com
Mon Jun 27 22:22:19 EDT 2016


> Not sure if this fits the bill, or makes sense here, but I came cross
> "docopt" which touts itself as a "Command-line interface description
> language". I used it in a project and it seems to be pretty easy to use
> as well as elegant. It stores the arguments & values as a dictionary,
> keyed by the argument.

Yea I have had my eye on docopt for a while, it doesn't support multiple
subparsers, as I am passing duplicate parameters from its perspective.

Imagine:

foo.py --host 172.18.0.4 --port 766 foo --warning 42 --critical 77 bar --warning 4.2 --critical 7.7

etc...

The shortcoming to argparse has been debated to death and the bug tracker
was just left hanging. To be honest, I am not clear on the opposition to it...

Thanks,
jlc


More information about the Python-list mailing list