diff --git a/README.md b/README.md index 365c165..b5492c9 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ program.add_argument("--verbose") .default_value(false) .implicit_value(true); -program.parse_args({ "./main", "4", "--verbose" }); +program.parse_args(argc, argv); int input = program.get("square"); @@ -100,6 +100,17 @@ else { } ``` +```bash +$ ./main 4 +16 + +$ ./main 4 --verbose +The square of 4 is 16 + +$ ./main --verbose 4 +The square of 4 is 16 +``` + ### List of Arguments ArgumentParser objects usually associate a single command-line argument with a single action to be taken. The ```.nargs``` associates a different number of command-line arguments with a single action. When using ```nargs(N)```, N arguments from the command line will be gathered together into a list.