add short strings to options, improve help output, improve tests

This commit is contained in:
Carl Pearson
2020-04-17 17:06:16 -05:00
parent 193219ac50
commit 661d569657
4 changed files with 172 additions and 41 deletions

View File

@@ -9,13 +9,13 @@ int main(int argc, char **argv) {
bool verbose = false;
std::string toPrint;
std::string maybePrint;
int repeats = 1;
int repeats = 2;
// 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");
p.add_option(repeats, "--repeat")->help("how many times to repeat first argument");
// A flag invoked with `--verbose` or `-v`
p.add_flag(verbose, "--verbose", "-v");
// a required positional argument (position 1)