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

Function main

examples/doc_example5.cpp:12–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10#include <lyra/lyra.hpp>
11
12int main(int argc, const char** argv)
13{
14 std::string choice;
15 // Ex: <exe> --choice=red
16 auto cli = lyra::cli()
17 | lyra::opt(choice, "-c")["--choice"]
18 .choices("red", "green", "blue");
19 auto result = cli.parse({ argc, argv });
20 if (result)
21 {
22 std::cout << "Your preferred color is " << choice << "\n";
23 return 0;
24 }
25 else
26 {
27 std::cerr << result.message() << "\n";
28 return 1;
29 }
30}
31// end::part1[]

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