Argparse with required subparser
You need to give subparsers a dest. parser = argparse.ArgumentParser() subparsers = parser.add_subparsers(dest=”cmd”) subparsers.required = True Now: 1909:~/mypy$ argdev/python3 stack23349349.py usage: stack23349349.py [-h] {foo} … stack23349349.py: error: the following arguments are required: cmd In order to issue this ‘missing arguments’ error message, the code needs to give that argument a name. For a positional argument … Read more