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

Function ParseCommandLine

test/run_output.cxx:49–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47};
48
49static CommandLine
50ParseCommandLine(int argc, char **argv)
51{
52 CommandLine c;
53
54 OptionParser option_parser(option_defs, argc, argv);
55 while (auto o = option_parser.Next()) {
56 switch (Option(o.index)) {
57 case OPTION_VERBOSE:
58 c.verbose = true;
59 break;
60 }
61 }
62
63 auto args = option_parser.GetRemaining();
64 if (args.size() < 2 || args.size() > 3)
65 throw std::runtime_error("Usage: run_output CONFIG NAME [FORMAT] <IN");
66
67 c.config_path = args[0];
68 c.output_name = args[1];
69
70 if (args.size() > 2)
71 c.audio_format = ParseAudioFormat(args[2], false);
72
73 return c;
74}
75
76static std::unique_ptr<AudioOutput>
77LoadAudioOutput(const ConfigData &config, EventLoop &event_loop,

Callers 1

mainFunction · 0.70

Calls 3

ParseAudioFormatFunction · 0.85
NextMethod · 0.80
OptionEnum · 0.70

Tested by

no test coverage detected