MCPcopy Create free account
hub / github.com/docopt/docopt.cpp / main

Function main

run_testcase.cpp:13–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11#include <iostream>
12
13int 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected