mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-03 22:54:39 +00:00
Updated README to include mutex_args feature
This commit is contained in:
parent
de4239483d
commit
e0a095571f
15
README.md
15
README.md
@ -298,6 +298,21 @@ foo@bar:/home/dev/$ ./main --first 1 --second 2
|
||||
Argument '--second VAR' not allowed with '--first VAR'
|
||||
```
|
||||
|
||||
The `add_mutually_exclusive_group()` function also accepts a `required` argument, to indicate that at least one of the mutually exclusive arguments is required:
|
||||
|
||||
```cpp
|
||||
auto &group = program.add_mutually_exclusive_group(true);
|
||||
group.add_argument("--first");
|
||||
group.add_argument("--second");
|
||||
```
|
||||
|
||||
with the following usage will yield an error:
|
||||
|
||||
```console
|
||||
foo@bar:/home/dev/$ ./main
|
||||
One of the arguments '--first VAR' or '--second VAR' is required
|
||||
```
|
||||
|
||||
### Negative Numbers
|
||||
|
||||
Optional arguments start with ```-```. Can ```argparse``` handle negative numbers? The answer is yes!
|
||||
|
Loading…
Reference in New Issue
Block a user