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

Function ParseCommandLine

src/CommandLine.cxx:329–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

327}
328
329void
330ParseCommandLine(int argc, char **argv, CommandLineOptions &options,
331 ConfigData &config)
332{
333 bool use_config_file = true;
334
335 // First pass: handle command line options
336 OptionParser parser(option_defs, argc, argv);
337 while (auto o = parser.Next()) {
338 switch (Option(o.index)) {
339 case OPTION_KILL:
340 options.kill = true;
341 break;
342
343 case OPTION_NO_CONFIG:
344 use_config_file = false;
345 break;
346
347 case OPTION_NO_DAEMON:
348#ifdef ENABLE_DAEMON
349 options.daemon = false;
350#endif
351 break;
352
353#ifdef __linux__
354 case OPTION_SYSTEMD:
355#ifdef ENABLE_DAEMON
356 options.daemon = false;
357#endif
358 options.systemd = true;
359 break;
360#endif
361
362 case OPTION_STDOUT:
363 case OPTION_STDERR:
364 options.log_stderr = true;
365 break;
366
367 case OPTION_VERBOSE:
368 options.verbose = true;
369 break;
370
371 case OPTION_VERSION:
372 version();
373
374 case OPTION_HELP:
375 case OPTION_HELP2:
376 help();
377 }
378 }
379
380 /* initialize the logging library, so the configuration file
381 parser can use it already */
382 log_early_init(options.verbose);
383
384 if (!use_config_file) {
385 LogDebug(cmdline_domain,
386 "Ignoring config, using daemon defaults");

Callers 1

MainOrThrowFunction · 0.70

Calls 11

versionFunction · 0.85
helpFunction · 0.85
log_early_initFunction · 0.85
ReadConfigFileFunction · 0.85
GetSystemConfigDirFunction · 0.85
GetAppBaseDirFunction · 0.85
NextMethod · 0.80
TryFileMethod · 0.80
OptionEnum · 0.70
GetUserConfigDirFunction · 0.50
GetHomeDirFunction · 0.50

Tested by

no test coverage detected