| 11 | #include <iostream> |
| 12 | |
| 13 | int main(int argc, const char** argv) |
| 14 | { |
| 15 | if (argc < 2) { |
| 16 | std::cerr << "Usage: docopt_tests USAGE [arg]..." << std::endl; |
| 17 | exit(-5); |
| 18 | } |
| 19 | |
| 20 | std::string usage = argv[1]; |
| 21 | std::vector<std::string> args {argv+2, argv+argc}; |
| 22 | |
| 23 | auto result = docopt::docopt(usage, args); |
| 24 | |
| 25 | // print it out in JSON form |
| 26 | std::cout << "{ "; |
| 27 | bool first = true; |
| 28 | for(auto const& arg : result) { |
| 29 | if (first) { |
| 30 | first = false; |
| 31 | } else { |
| 32 | std::cout << "," << std::endl; |
| 33 | } |
| 34 | |
| 35 | std::cout << '"' << arg.first << '"' << ": " << arg.second; |
| 36 | } |
| 37 | std::cout << " }" << std::endl; |
| 38 | |
| 39 | return 0; |
| 40 | } |
nothing calls this directly
no outgoing calls
no test coverage detected