I try to build an argparser, where one of the parsers should have a default value, and is also a required. I have the following so far:
fulllist_parser.add_argument(
'--type',
required=True,
default="VirtualMachine",
type=str,
help='Object type, e.g. Network, VirtualMachine.'
When I run it from CLI, I get an error:
supdeploy fulllist: error: argument --type is required
I see why this is coming up, as I'm not including --type
on the CLI.
And that is what I want to achieve, that the default is set even if I don't include the parser option on CLI.
Anyway to run this?