improve example
This commit is contained in:
@@ -28,11 +28,16 @@ int main(int argc, char **argv) {
|
||||
std::string maybePrint;
|
||||
int repeats = 1;
|
||||
|
||||
// Inform the parser of the program data.
|
||||
// It will do type-specific conversion
|
||||
// Inform the parser of the program data. It will do type-specific conversion
|
||||
// from string.
|
||||
|
||||
// An option invoked with `--repeat N`
|
||||
p.add_option(repeats, "--repeat");
|
||||
// A flag invoked with `--verbose` or `-v`
|
||||
p.add_flag(verbose, "--verbose", "-v");
|
||||
// a required positional argument (position 1)
|
||||
p.add_positional(toPrint)->required();
|
||||
// an optional positional argument (position 2)
|
||||
auto psnl = p.add_positional(maybePrint);
|
||||
|
||||
// If there was an error during parsing, report it.
|
||||
|
@@ -11,11 +11,16 @@ int main(int argc, char **argv) {
|
||||
std::string maybePrint;
|
||||
int repeats = 1;
|
||||
|
||||
// Inform the parser of the program data.
|
||||
// It will do type-specific conversion
|
||||
// Inform the parser of the program data. It will do type-specific conversion
|
||||
// from string.
|
||||
|
||||
// An option invoked with `--repeat N`
|
||||
p.add_option(repeats, "--repeat");
|
||||
// A flag invoked with `--verbose` or `-v`
|
||||
p.add_flag(verbose, "--verbose", "-v");
|
||||
// a required positional argument (position 1)
|
||||
p.add_positional(toPrint)->required();
|
||||
// an optional positional argument (position 2)
|
||||
auto psnl = p.add_positional(maybePrint);
|
||||
|
||||
// If there was an error during parsing, report it.
|
||||
|
Reference in New Issue
Block a user