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

Function ParseCommandLine

test/run_decoder.cxx:51–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.70

Calls 2

NextMethod · 0.80
OptionEnum · 0.70

Tested by

no test coverage detected