MCPcopy Create free account
hub / github.com/Project-LemonLime/Project_LemonLime / parseCommandLine

Method parseCommandLine

src/base/LemonBaseApplication.cpp:55–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55auto LemonBaseApplication::parseCommandLine(bool *canContinue, QString *errorMessage) -> bool {
56 *canContinue = true;
57 QStringList filteredArgs;
58 for (const auto &arg : arguments()) {
59#ifdef Q_OS_MACOS
60 if (arg.contains("-psn"))
61 continue;
62#endif
63 filteredArgs << arg;
64 }
65 QCommandLineParser parser;
66 //
67 QCommandLineOption debugLogOption("debug", QObject::tr("Enable debug output"));
68 //
69 parser.setApplicationDescription(QObject::tr("LemonLime - A tiny judging environment for OI contest."));
70 parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
71 //
72 parser.addOption(debugLogOption);
73 //
74 const auto helpOption = parser.addHelpOption();
75 const auto versionOption = parser.addVersionOption();
76
77 if (! parser.parse(filteredArgs)) {
78 *canContinue = true;
79 *errorMessage = parser.errorText();
80 return false;
81 }
82
83 if (parser.isSet(versionOption)) {
84 parser.showVersion();
85 return true;
86 }
87
88 if (parser.isSet(helpOption)) {
89 parser.showHelp();
90 return true;
91 }
92
93#define ProcessExtraStartupOptions(option) \
94 DEBUG("Startup Options:" GEN_PAIR(parser.isSet(option##Option))); \
95 StartupArguments.option = parser.isSet(option##Option);
96
97 ProcessExtraStartupOptions(debugLog);
98 return true;
99}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected