Using argparse
, I'd like to be able to have two separate but co-requisite (and otherwise optional) options.
This is similar to Python argparse: Require two corequisite positional arguments, however the solution suggested there doesn't work for me because I want the options to be separate and named.
I want the usage to look a bit like this:
foo.py [-h] [--username USER --password PASS] OTHER_ARGS
I want the user to be able to either provide both the --username
and --password
options, or neither, but to receive an error if they only pass one.