Shows how to structure a python app using arg parse that goes down many levels.
The "trick" is to
- add a subparsers
S1[]
- add parsers
P1[]
to your subparserS1[x]
- add a new set of subparsers
S2[]
to one of those parsersP1[x]
You can keep going from there.
Some other tips:
- use lots of
if
statements - group parsers and add common arguments in loops
Because there is only 1 command on each level argparse compressed the help message a bit so calling help even on the top level shows this
If you add more commands on each level that changes.