mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-27 23:17:13 +03:00
clear error hint went wrongly use command line options
This commit is contained in:
parent
e390c22f96
commit
263fa5882b
2 changed files with 15 additions and 8 deletions
|
@ -351,19 +351,19 @@ void Application::parseOptions(const QStringList &options)
|
||||||
if (it.hasNext() && !it.peekNext().startsWith(QLatin1String("--"))) {
|
if (it.hasNext() && !it.peekNext().startsWith(QLatin1String("--"))) {
|
||||||
_logFile = it.next();
|
_logFile = it.next();
|
||||||
} else {
|
} else {
|
||||||
setHelp();
|
showHint("Log file not specified");
|
||||||
}
|
}
|
||||||
} else if (option == QLatin1String("--logdir")) {
|
} else if (option == QLatin1String("--logdir")) {
|
||||||
if (it.hasNext() && !it.peekNext().startsWith(QLatin1String("--"))) {
|
if (it.hasNext() && !it.peekNext().startsWith(QLatin1String("--"))) {
|
||||||
_logDir = it.next();
|
_logDir = it.next();
|
||||||
} else {
|
} else {
|
||||||
setHelp();
|
showHint("Log dir not specified");
|
||||||
}
|
}
|
||||||
} else if (option == QLatin1String("--logexpire")) {
|
} else if (option == QLatin1String("--logexpire")) {
|
||||||
if (it.hasNext() && !it.peekNext().startsWith(QLatin1String("--"))) {
|
if (it.hasNext() && !it.peekNext().startsWith(QLatin1String("--"))) {
|
||||||
_logExpire = it.next().toInt();
|
_logExpire = it.next().toInt();
|
||||||
} else {
|
} else {
|
||||||
setHelp();
|
showHint("Log expiration not specified");
|
||||||
}
|
}
|
||||||
} else if (option == QLatin1String("--logflush")) {
|
} else if (option == QLatin1String("--logflush")) {
|
||||||
_logFlush = true;
|
_logFlush = true;
|
||||||
|
@ -371,17 +371,15 @@ void Application::parseOptions(const QStringList &options)
|
||||||
if (it.hasNext() && !it.peekNext().startsWith(QLatin1String("--"))) {
|
if (it.hasNext() && !it.peekNext().startsWith(QLatin1String("--"))) {
|
||||||
QString confDir = it.next();
|
QString confDir = it.next();
|
||||||
if (!ConfigFile::setConfDir( confDir )) {
|
if (!ConfigFile::setConfDir( confDir )) {
|
||||||
std::cerr << "Invalid path passed to --confdir" << std::endl;
|
showHint("Invalid path passed to --confdir");
|
||||||
std::exit(1);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
showHelp();
|
showHint("Path for confdir not specified");
|
||||||
}
|
}
|
||||||
} else if (option == QLatin1String("--debug")) {
|
} else if (option == QLatin1String("--debug")) {
|
||||||
_debugMode = true;
|
_debugMode = true;
|
||||||
} else {
|
} else {
|
||||||
setHelp();
|
showHint("Unrecognized option '" + option.toStdString() + "'");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -430,6 +428,14 @@ void Application::showHelp()
|
||||||
displayHelpText(helpText);
|
displayHelpText(helpText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::showHint(std::string errorHint)
|
||||||
|
{
|
||||||
|
static QString binName = QFileInfo(QCoreApplication::applicationFilePath()).fileName();
|
||||||
|
std::cerr << errorHint << std::endl;
|
||||||
|
std::cerr << "Try '" << binName.toStdString() << " --help' for more information" << std::endl;
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
bool Application::debugMode()
|
bool Application::debugMode()
|
||||||
{
|
{
|
||||||
return _debugMode;
|
return _debugMode;
|
||||||
|
|
|
@ -56,6 +56,7 @@ public:
|
||||||
|
|
||||||
bool giveHelp();
|
bool giveHelp();
|
||||||
void showHelp();
|
void showHelp();
|
||||||
|
void showHint(std::string errorHint);
|
||||||
bool debugMode();
|
bool debugMode();
|
||||||
|
|
||||||
void showSettingsDialog();
|
void showSettingsDialog();
|
||||||
|
|
Loading…
Reference in a new issue