MCPcopy Create free account
hub / github.com/MusicPlayerDaemon/MPD / ParseCommandLine

Function ParseCommandLine

test/RunChromaprint.cxx:48–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46};
47
48static CommandLine
49ParseCommandLine(int argc, char **argv)
50{
51 CommandLine c;
52
53 OptionParser option_parser(option_defs, argc, argv);
54 while (auto o = option_parser.Next()) {
55 switch (Option(o.index)) {
56 case OPTION_CONFIG:
57 c.config_path = o.value;
58 break;
59
60 case OPTION_VERBOSE:
61 c.verbose = true;
62 break;
63 }
64 }
65
66 auto args = option_parser.GetRemaining();
67 if (args.size() != 2)
68 throw std::runtime_error("Usage: RunChromaprint [--verbose] [--config=FILE] DECODER URI");
69
70 c.decoder = args[0];
71 c.uri = args[1];
72 return c;
73}
74
75class GlobalInit {
76 const ConfigData config;

Callers 1

mainFunction · 0.70

Calls 2

NextMethod · 0.80
OptionEnum · 0.70

Tested by

no test coverage detected