add task helper

This commit is contained in:
2017-03-15 02:31:25 +03:00
parent 9931204837
commit f59095dbb0
8 changed files with 186 additions and 64 deletions

View File

@ -42,13 +42,13 @@ int main(int argc, char *argv[])
// info
QCommandLineOption infoOption(QStringList() << "i"
<< "info",
"Show additional info.");
"Shows additional info.");
parser.addOption(infoOption);
// debug mode
QCommandLineOption debugOption(QStringList() << "d"
<< "debug",
"Print debug information.");
"Prints debug information.");
parser.addOption(debugOption);
// configuration option
@ -63,6 +63,10 @@ int main(int argc, char *argv[])
"user", ::getlogin());
parser.addOption(userOption);
// additional help option
QCommandLineOption commandsOption("commands", "Lists available commands.");
parser.addOption(commandsOption);
parser.addPositionalArgument("command", "Command to execute.", "<command>");
// pre-parse
@ -80,6 +84,12 @@ int main(int argc, char *argv[])
QDebug(QtMsgType::QtInfoMsg).noquote() << string;
return 0;
}
if (parser.isSet(commandsOption)) {
QDebug(QtMsgType::QtInfoMsg).noquote() << parser.helpText();
QDebug(QtMsgType::QtInfoMsg).noquote()
<< QueuedctlCommon::commandsHelp();
return 0;
}
// enable debug
if (parser.isSet(debugOption))