mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-04 07:04:39 +00:00
Update "Printing Help" documentation
Help output has changed format over time. This updates the README example to reflect current practice by running the example code and copy-pasting its output. Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
This commit is contained in:
parent
ea1f7ef663
commit
5cceb98e3c
11
README.md
11
README.md
@ -257,7 +257,7 @@ As you can see here, ```argparse``` supports negative integers, negative floats
|
|||||||
### Combining Positional and Optional Arguments
|
### Combining Positional and Optional Arguments
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
argparse::ArgumentParser program("test");
|
argparse::ArgumentParser program("main");
|
||||||
|
|
||||||
program.add_argument("square")
|
program.add_argument("square")
|
||||||
.help("display the square of a given number")
|
.help("display the square of a given number")
|
||||||
@ -303,14 +303,15 @@ The square of 4 is 16
|
|||||||
|
|
||||||
```
|
```
|
||||||
$ ./main --help
|
$ ./main --help
|
||||||
Usage: ./main [options] square
|
Usage: main [options] square
|
||||||
|
|
||||||
Positional arguments:
|
Positional arguments:
|
||||||
square display a square of a given number
|
square display the square of a given number
|
||||||
|
|
||||||
Optional arguments:
|
Optional arguments:
|
||||||
-h, --help show this help message and exit
|
-h --help shows help message and exits [default: false]
|
||||||
-v, --verbose enable verbose logging
|
-v --version prints version information and exits [default: false]
|
||||||
|
--verbose [default: false]
|
||||||
```
|
```
|
||||||
|
|
||||||
You may also get the help message in string via `program.help().str()`.
|
You may also get the help message in string via `program.help().str()`.
|
||||||
|
Loading…
Reference in New Issue
Block a user