blob: d16742a007f2322da9b475c187df39d8921d7a87 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#include "src/command_line.h"
#include <QDebug>
#include <QApplication>
CommandLineParsedOptions parse_command_line(QCommandLineParser &parser, QApplication &app) {
QCommandLineOption fileOption({"f", "file"},
QCoreApplication::translate("cmdline", "Data export to open."),
"file");
parser.addOption(fileOption);
const QCommandLineOption help_option = parser.addHelpOption();
const QCommandLineOption version_option = parser.addVersionOption();
QString outbox_filename;
if (!parser.parse(app.arguments()))
return {CommandLineError, parser.errorText(), outbox_filename};
if (parser.isSet(help_option) or parser.isSet("help-all"))
return {CommandLineHelpRequested, nullptr, outbox_filename};
if (parser.isSet(version_option))
return {CommandLineVersionRequested, nullptr, outbox_filename};
outbox_filename = parser.value(fileOption);
return {CommandLineOk, nullptr, outbox_filename};
}
|