Skip to content Skip to sidebar Skip to footer

How To Show Argparse Subcommands In Groups?

For a program with many subcommands, I'd like to show them logically grouped in the --help output. Python argparse has a add_argument_group method, but it doesn't seem compatible

Solution 1:

You can't really do it in any straightforward way, other than implementing a custom HelpFormatter.

You can find some more information on HelpFormatter flavors in this part of the documentation.

Post a Comment for "How To Show Argparse Subcommands In Groups?"