I have a program which can be used in the following way:
program install -a arg -b arg program list program update There can only ever be one of the positional arguments specified (install, list or update). And there can only be other arguments in the install scenario.
The argparse documentation is a little dense and I'm having a hard time figuring out how to do this correctly. What should my add_arguments look like?
argparsedocumentation is something I struggle with nearly every time I go to do something non-trivial with it.argparsedoc is very good, and if you want to master the commandline in python. I think you need to read it. Recently I write some nagios plugins in python, and the argparse is very important. So I have read the doc some times, it was really very good.