Commit 81f1f440edf05aeaf4744ee7a6658789dc425468
1 parent
3ce8cbd1
count arguments
Showing
1 changed file
with
3 additions
and
2 deletions
src/example.cpp
| @@ -41,7 +41,7 @@ int main(int argc, char* argv[]) | @@ -41,7 +41,7 @@ int main(int argc, char* argv[]) | ||
| 41 | ("i,input", "Input", cxxopts::value<std::string>()) | 41 | ("i,input", "Input", cxxopts::value<std::string>()) |
| 42 | ("o,output", "Output file", cxxopts::value<std::string>() | 42 | ("o,output", "Output file", cxxopts::value<std::string>() |
| 43 | ->default_value("a.out")->implicit_value("b.def"), "BIN") | 43 | ->default_value("a.out")->implicit_value("b.def"), "BIN") |
| 44 | - ("positional", | 44 | + ("positional", |
| 45 | "Positional arguments: these are the arguments that are entered " | 45 | "Positional arguments: these are the arguments that are entered " |
| 46 | "without an option", cxxopts::value<std::vector<std::string>>()) | 46 | "without an option", cxxopts::value<std::vector<std::string>>()) |
| 47 | ("long-description", | 47 | ("long-description", |
| @@ -71,7 +71,8 @@ int main(int argc, char* argv[]) | @@ -71,7 +71,8 @@ int main(int argc, char* argv[]) | ||
| 71 | 71 | ||
| 72 | if (apple) | 72 | if (apple) |
| 73 | { | 73 | { |
| 74 | - std::cout << "Saw option ‘a’" << std::endl; | 74 | + std::cout << "Saw option ‘a’ " << options.count("a") << " times " << |
| 75 | + std::endl; | ||
| 75 | } | 76 | } |
| 76 | 77 | ||
| 77 | if (options.count("b")) | 78 | if (options.count("b")) |