Skip to content Skip to sidebar Skip to footer

Multiple Level Argparse Subparsers

I have multiple levels of subparsers within subparsers, but when I run the program with help flag, I see help messages and choices only for top level options. How can I see help fo

Solution 1:

To get the help for a subparser, use a command like python prog.py cmd1 -h. To get the help for a sub-subparser, python prog.py cmd1 cmd12 -h should work.

There isn't a means, with the default help mechanism, to show the help for the main parser and all the subparsers (and sub-subparsers) with one command. It just gets too complicated.

I'd suggest custom usage and description. That includes titles and descriptions for the subparsers, etc.

Post a Comment for "Multiple Level Argparse Subparsers"