I'd like to do the following, where the type
specified dictates what parameters I can use after.
For example, for cmd1
, I'd expect a param1
and param2
.
For cmd2
, I'd expect a param3
, param4
, param5
, and param6
.
For cmd3
, I'd expect no parameters.
If I don't specify the expected parameters, an error should be shown.
Also, is there someway I could make it so that issuing a -h
would show the different combinations allowed?
In all situations, there may be other tags that could be specified, such as --id 5
or --config 1
.
Is this possible with python's argparse?
I.e.,
python test.py --type cmd1 param1 param2 --id 5
python test.py --config 2 --type cmd2 param3 param4 param5 param6
python test.py --type cmd3 --config 1