Fix display command help.
This commit is contained in:
parent
5952218487
commit
d5bc7c071b
1 changed files with 27 additions and 13 deletions
|
|
@ -403,6 +403,16 @@ void App::init() {
|
||||||
createCommandParser(); // Recreate parser in order to use translations from config.
|
createCommandParser(); // Recreate parser in order to use translations from config.
|
||||||
mParser->process(*this);
|
mParser->process(*this);
|
||||||
|
|
||||||
|
if (mParser->isSet("help")) {
|
||||||
|
mParser->showHelp();
|
||||||
|
::exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mParser->isSet("version")) {
|
||||||
|
mParser->showVersion();
|
||||||
|
::exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
if (!mLinphoneThread->isRunning()) {
|
if (!mLinphoneThread->isRunning()) {
|
||||||
lInfo() << log().arg("Starting Thread");
|
lInfo() << log().arg("Starting Thread");
|
||||||
mLinphoneThread->start();
|
mLinphoneThread->start();
|
||||||
|
|
@ -678,22 +688,26 @@ void App::createCommandParser() {
|
||||||
if (!mParser) delete mParser;
|
if (!mParser) delete mParser;
|
||||||
|
|
||||||
mParser = new QCommandLineParser();
|
mParser = new QCommandLineParser();
|
||||||
mParser->setApplicationDescription(tr("applicationDescription"));
|
mParser->setApplicationDescription(tr("A free (libre) SIP video-phone."));
|
||||||
mParser->addPositionalArgument("command", tr("commandLineDescription").replace("%1", APPLICATION_NAME),
|
mParser->addPositionalArgument(
|
||||||
|
"command", tr("Send an order to the application towards a command line").replace("%1", APPLICATION_NAME),
|
||||||
"[command]");
|
"[command]");
|
||||||
mParser->addOptions({
|
mParser->addOptions({
|
||||||
{{"h", "help"}, tr("commandLineOptionHelp")},
|
{{"h", "help"}, tr("Show this help")},
|
||||||
{"cli-help", tr("commandLineOptionCliHelp").replace("%1", APPLICATION_NAME)},
|
//{"cli-help", tr("commandLineOptionCliHelp").replace("%1", APPLICATION_NAME)},
|
||||||
{{"v", "version"}, tr("commandLineOptionVersion")},
|
{{"v", "version"}, tr("Show app version")},
|
||||||
{"config", tr("commandLineOptionConfig").replace("%1", EXECUTABLE_NAME), tr("commandLineOptionConfigArg")},
|
//{"config", tr("commandLineOptionConfig").replace("%1", EXECUTABLE_NAME), tr("commandLineOptionConfigArg")},
|
||||||
{"fetch-config", tr("commandLineOptionFetchConfig").replace("%1", EXECUTABLE_NAME),
|
{"fetch-config",
|
||||||
tr("commandLineOptionFetchConfigArg")},
|
tr("Specify the linphone configuration file to be fetched. It will be merged with the current "
|
||||||
{{"c", "call"}, tr("commandLineOptionCall").replace("%1", EXECUTABLE_NAME), tr("commandLineOptionCallArg")},
|
"configuration.")
|
||||||
|
.replace("%1", EXECUTABLE_NAME),
|
||||||
|
tr("URL, path or file")},
|
||||||
|
//{{"c", "call"}, tr("commandLineOptionCall").replace("%1", EXECUTABLE_NAME), tr("commandLineOptionCallArg")},
|
||||||
#ifndef Q_OS_MACOS
|
#ifndef Q_OS_MACOS
|
||||||
{"minimized", tr("commandLineOptionMinimized")},
|
//{"minimized", tr("commandLineOptionMinimized")},
|
||||||
#endif // ifndef Q_OS_MACOS
|
#endif // ifndef Q_OS_MACOS
|
||||||
{{"V", "verbose"}, tr("commandLineOptionVerbose")},
|
{{"V", "verbose"}, tr("Log to stdout some debug information while running")},
|
||||||
{"qt-logs-only", tr("commandLineOptionQtLogsOnly")},
|
{"qt-logs-only", tr("Print only logs from the application")},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Should be call only at first start
|
// Should be call only at first start
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue