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

Function ParseCommandLine

test/run_storage.cxx:75–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73};
74
75static CommandLine
76ParseCommandLine(int argc, char **argv)
77{
78 CommandLine c;
79
80 OptionParser option_parser(option_defs, argc, argv);
81 while (auto o = option_parser.Next()) {
82 switch (static_cast<Option>(o.index)) {
83 case Option::CONFIG:
84 c.config_path = o.value;
85 break;
86
87 case Option::VERBOSE:
88 c.verbose = true;
89 break;
90 }
91 }
92
93 auto args = option_parser.GetRemaining();
94 if (args.empty())
95 throw std::runtime_error{usage_text};
96
97 c.command = args.front();
98 c.args = args.subspan(1);
99 return c;
100}
101
102class GlobalInit {
103 const ConfigData config;

Callers 1

mainFunction · 0.70

Calls 2

NextMethod · 0.80
emptyMethod · 0.80

Tested by

no test coverage detected