2 #include <QCoreApplication>
3 #include <QCommandLineParser>
8 int main(
int argc,
char *argv[])
10 QCoreApplication a(argc, argv);
12 QCommandLineParser parser;
13 parser.setApplicationDescription(
"Kona IP Json Setup");
14 parser.addHelpOption();
15 parser.addVersionOption();
16 const QCommandLineOption deviceOption(
"d",
"device to use",
"device");
17 parser.addOption(deviceOption);
18 const QCommandLineOption boardOption(
"b",
"device to use",
"board");
19 parser.addOption(boardOption);
20 const QCommandLineOption keywordsOption(
"k",
"list supported JSON keywords");
21 parser.addOption(keywordsOption);
22 parser.addPositionalArgument(
"InputJsonFile", QCoreApplication::translate(
"main",
"Json File to Open."));
26 if (parser.isSet(keywordsOption))
28 std::cout <<
keywordList.toStdString() << std::endl;
34 if (parser.isSet(deviceOption))
36 device = parser.value(deviceOption);
39 if (parser.isSet(boardOption))
41 device = parser.value(boardOption);
43 std::string devStr = device.toUtf8().constData();
45 const QStringList args = parser.positionalArguments();
46 if ( args.size() == 1 )
48 qDebug() << args.at(0);
51 bool rv = jsonSetup.
openJson(args.at(0));
54 std::cout <<
"Failed to parse JSON" << std::endl;