Adding debug info to CLI.
Adding debug info to the CLI and the general option of the main Qt app. Also took time to: * use `EXIT_SUCCESS`/`EXIT_FAILURE` constants for main.cpp (this is what is used in `src/cli`); * fixed `m_initalized` typo; * added info on debugging mode being disabled or not; * regrouped Qt related stuff in the debug output.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
|
||||
#include "config-keepassx.h"
|
||||
#include "core/Bootstrap.h"
|
||||
#include "core/Tools.h"
|
||||
#include "crypto/Crypto.h"
|
||||
|
||||
#if defined(WITH_ASAN) && defined(WITH_LSAN)
|
||||
@@ -60,6 +61,9 @@ int main(int argc, char** argv)
|
||||
|
||||
parser.addPositionalArgument("command", QObject::tr("Name of the command to execute."));
|
||||
|
||||
QCommandLineOption debugInfoOption(QStringList() << "debug-info",
|
||||
QObject::tr("Displays debugging information."));
|
||||
parser.addOption(debugInfoOption);
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
// TODO : use the setOptionsAfterPositionalArgumentsMode (Qt 5.6) function
|
||||
@@ -72,6 +76,10 @@ int main(int argc, char** argv)
|
||||
// Switch to parser.showVersion() when available (QT 5.4).
|
||||
out << KEEPASSXC_VERSION << endl;
|
||||
return EXIT_SUCCESS;
|
||||
} else if (parser.isSet(debugInfoOption)) {
|
||||
QString debugInfo = Tools::debugInfo().append("\n").append(Crypto::debugInfo());
|
||||
out << debugInfo << endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
parser.showHelp();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user