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

Function ParseCommandLine

test/run_convert.cxx:50–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48};
49
50static CommandLine
51ParseCommandLine(int argc, char **argv)
52{
53 CommandLine c;
54
55 OptionParser option_parser(option_defs, argc, argv);
56 while (auto o = option_parser.Next()) {
57 switch (Option(o.index)) {
58 case OPTION_CONFIG:
59 c.config_path = o.value;
60 break;
61
62 case OPTION_VERBOSE:
63 c.verbose = true;
64 break;
65 }
66 }
67
68 auto args = option_parser.GetRemaining();
69 if (args.size() != 2)
70 throw std::runtime_error("Usage: run_convert IN_FORMAT OUT_FORMAT <IN >OUT");
71
72 c.in_audio_format = ParseAudioFormat(args[0], false);
73 c.out_audio_format = c.in_audio_format.WithMask(ParseAudioFormat(args[1], false));
74 return c;
75}
76
77class GlobalInit {
78 const ConfigData config;

Callers 1

mainFunction · 0.70

Calls 3

ParseAudioFormatFunction · 0.85
NextMethod · 0.80
OptionEnum · 0.70

Tested by

no test coverage detected