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
cb69613899
commit
216530e330
@ -22,6 +22,8 @@ argparse::ArgumentParser program("program name");
|
|||||||
|
|
||||||
Argparse supports a variety of argument types including positional arguments, optional arguments, toggle arguments and compound arguments.
|
Argparse supports a variety of argument types including positional arguments, optional arguments, toggle arguments and compound arguments.
|
||||||
|
|
||||||
|
### Positional Arguments
|
||||||
|
|
||||||
Here's an example of a ***positional argument***:
|
Here's an example of a ***positional argument***:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
@ -48,6 +50,8 @@ Here's what's happening:
|
|||||||
* The parse_args() method parses the arguments provided, converts our input into an integer and returns the square.
|
* The parse_args() method parses the arguments provided, converts our input into an integer and returns the square.
|
||||||
* We can get the value stored by the parser for a given argument using ```parser.get<T>(key)``` method.
|
* We can get the value stored by the parser for a given argument using ```parser.get<T>(key)``` method.
|
||||||
|
|
||||||
|
### Optional Arguments
|
||||||
|
|
||||||
Now, let's look at ***optional arguments***. Optional arguments start with ```-``` or ```--```, e.g., "--verbose" or "-a". Optional arguments can be placed anywhere in the input sequence.
|
Now, let's look at ***optional arguments***. Optional arguments start with ```-``` or ```--```, e.g., "--verbose" or "-a". Optional arguments can be placed anywhere in the input sequence.
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user