mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-04 15:14:39 +00:00
Update README.md
This commit is contained in:
parent
acfa32e5c1
commit
61e9b644c0
@ -124,7 +124,7 @@ Here's what's happening:
|
|||||||
There are scenarios where you would like to make an optional argument ***required***. As discussed above, optional arguments either begin with `-` or `--`. You can make these types of arguments required like so:
|
There are scenarios where you would like to make an optional argument ***required***. As discussed above, optional arguments either begin with `-` or `--`. You can make these types of arguments required like so:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
program.add_argument("-o", "--output")
|
program.add_argument("-o", "--output")
|
||||||
.required()
|
.required()
|
||||||
.help("specify the output file.");
|
.help("specify the output file.");
|
||||||
```
|
```
|
||||||
@ -134,7 +134,7 @@ If the user does not provide a value for this parameter, an exception is thrown.
|
|||||||
Alternatively, you could provide a default value like so:
|
Alternatively, you could provide a default value like so:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
program.add_argument("-o", "--output")
|
program.add_argument("-o", "--output")
|
||||||
.default_value(std::string("-"))
|
.default_value(std::string("-"))
|
||||||
.required()
|
.required()
|
||||||
.help("specify the output file.");
|
.help("specify the output file.");
|
||||||
|
Loading…
Reference in New Issue
Block a user