I'm making a program you need to supply arguments to.
I want to use argparse but I can't figure out how I can make it work when I supply --full
argument it should print full info about let's say airport containing code, name and city of airport, when --name
and --code
is supplied it would print just name and code of airport.
The question is how can I make --full and group of (--name
, --code
, --city
) mutually exclusive?
I want something like this:
$./airports.py --full
{'city': 'London','name': 'Heathrow', 'code': 'LHR'}
...
$./airports.py --city --code
{'city': 'London', 'code': 'LHR'}
...
$./airports.py --city --code --full
Error: '--city' and '--code' can't be used with '--full'