MCPcopy Create free account
hub / github.com/bfgroup/Lyra / main

Function main

examples/doc_example1.cpp:13–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11#include <lyra/lyra.hpp>
12
13int main(int argc, const char** argv)
14{
15 // Where we read in the argument value:
16 int width = 0;
17
18 // The parser with the one option argument:
19 auto cli = lyra::cli()
20 | lyra::opt(width, "width")
21 ["-w"]["--width"]("How wide should it be?");
22
23 // ...
24 // end::part1[]
25 // tag::part2[]
26 // ...
27
28 // Parse the program arguments:
29 auto result = cli.parse({ argc, argv });
30
31 // Check that the arguments where valid:
32 if (!result)
33 {
34 std::cerr << "Error in command line: " << result.message() << std::endl;
35 return 1;
36 }
37
38 std::cout << "width = " << width << "\n";
39 return 0;
40}
41// end::part2[]

Callers

nothing calls this directly

Calls 4

cliClass · 0.50
optClass · 0.50
parseMethod · 0.45
messageMethod · 0.45

Tested by

no test coverage detected