Month: May 2020

Subcommands with Argument Parsing in Python

An example how subcommands can be used with argparse module: Sample output: markku@btest:~/temp$ python3 argtest.py usage: argtest.py [-h] [-c CONFIG_FILE] {update-device,add-vlan} … positional arguments: {update-device,add-vlan} update-device update device data add-vlan add a VLAN optional arguments: -h, –help show this help message and exit -c CONFIG_FILE, –config-file CONFIG_FILE specify the configuration file to read (default: argtest.cfg) […]