Use optional instead of zero_or_one

This commit is contained in:
Yoshihiro Hokazono 2022-06-22 09:24:51 +09:00
parent e44023f424
commit acff046fc5
2 changed files with 3 additions and 3 deletions

View File

@ -422,7 +422,7 @@ program.add_argument("--input_files")
```
```cpp
program.add_argument("--input_files")
.nargs(argparse::nargs_pattern::zero_or_one); // "?" in Python. This accepts an argument optionally.
.nargs(argparse::nargs_pattern::optional); // "?" in Python. This accepts an argument optionally.
```
### Compound Arguments

View File

@ -360,7 +360,7 @@ public:
};
enum class nargs_pattern {
zero_or_one,
optional,
any,
at_least_one
};
@ -507,7 +507,7 @@ public:
Argument &nargs(nargs_pattern pattern) {
switch (pattern) {
case nargs_pattern::zero_or_one:
case nargs_pattern::optional:
m_num_args_range = SizeRange{0, 1};
break;
case nargs_pattern::any: