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

Function ParseCommandLine

test/run_filter.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_VERBOSE:
59 c.verbose = true;
60 break;
61 }
62 }
63
64 auto args = option_parser.GetRemaining();
65 if (args.size() < 2 || args.size() > 3)
66 throw std::runtime_error("Usage: run_filter CONFIG NAME [FORMAT] <IN");
67
68 c.config_path = args[0];
69 c.filter_name = args[1];
70
71 if (args.size() > 2)
72 c.audio_format = ParseAudioFormat(args[2], false);
73
74 return c;
75}
76
77static std::unique_ptr<PreparedFilter>
78LoadFilter(const ConfigData &config, const char *name)

Callers 1

mainFunction · 0.70

Calls 3

ParseAudioFormatFunction · 0.85
NextMethod · 0.80
OptionEnum · 0.70

Tested by

no test coverage detected