You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I try to define an optional parameter with a value + default value, but it doesn't work as I expect.
I use version 3.0.
What I'd like to obtain:
Optional [] in usage section: Usage: [--format1 VAR] --format2 VAR --format3 VAR [--format4 VAR]
ok for format1 and format4
Exception if argument is called without value: ok for --format2 and --format3
No mention of [nargs=0..1] in argument section:
--format1 Image format [jpg|png] [nargs=0..1] [default: "jpg"]
--format2 Image format r1 [jpg|png] [default: "jpg"] => ok
--format3 Image format r [jpg|png] [nargs=0..1] [default: "jpg"]
--format4 Image format 1 [jpg|png] [default: "jpg"] => ok
No mention of [required] in argument section: ok for all
Listed in "Optional arguments" section: ok for all
Could you help me?
Here is a sample program:
command.add_argument("--format1")
.default_value(string("jpg"))
.help("Image format [jpg|png]");
command.add_argument("--format2")
.default_value(string("jpg"))
.required()
.nargs(1)
.help("Image format r1 [jpg|png]");
command.add_argument("--format3")
.default_value(string("jpg"))
.required()
.help("Image format r [jpg|png]");
command.add_argument("--format4")
.default_value(string("jpg"))
.nargs(1)
.help("Image format 1 [jpg|png]");
The text was updated successfully, but these errors were encountered:
Hello,
I try to define an optional parameter with a value + default value, but it doesn't work as I expect.
I use version 3.0.
What I'd like to obtain:
Usage: [--format1 VAR] --format2 VAR --format3 VAR [--format4 VAR]
ok for
format1
andformat4
--format2
and--format3
[nargs=0..1]
in argument section:[required]
in argument section: ok for allCould you help me?
Here is a sample program:
The text was updated successfully, but these errors were encountered: