I am trying to come up with a tool to log-into my server: myLogin [-h] [--ip [Address]] [UserName] [Password]
- When --ip is not used, then tool will use an URL name (my.server.net) for connection.
- When --ip is used but no Address supplied, then tool will use default IP address (192.168.1.1) for connection.
- Address cannot be supplied without --ip switch.
- UserName and Password are optional and have built-in defaults.
How do I achieve nested optional arguments with dependency: [--ip [Address]] using python argparse library?
I tried using add_subparsers and add_argument_group without any luck.
nargs='?' withdefault` andconstparameters.