Feature : --key-file option for CLI (#816)

* removing readFromLine

* Removing gui-prompt

* execute uses an arg list.

* Testing with key-file

* Fixing the -a option in EntropyMeter.
This commit is contained in:
louib 2017-07-25 13:41:52 -04:00 committed by GitHub
parent 1edabc4b3c
commit 1d30283514
23 changed files with 92 additions and 189 deletions

View file

@ -43,6 +43,9 @@ int main(int argc, char** argv)
return EXIT_FAILURE;
}
QCoreApplication app(argc, argv);
app.setApplicationVersion(KEEPASSX_VERSION);
QTextStream out(stdout);
QStringList arguments;
for (int i = 0; i < argc; ++i) {
@ -67,8 +70,6 @@ int main(int argc, char** argv)
parser.parse(arguments);
if (parser.positionalArguments().size() < 1) {
QCoreApplication app(argc, argv);
app.setApplicationVersion(KEEPASSX_VERSION);
if (parser.isSet("version")) {
// Switch to parser.showVersion() when available (QT 5.4).
out << KEEPASSX_VERSION << endl;
@ -82,14 +83,14 @@ int main(int argc, char** argv)
if (command == nullptr) {
qCritical("Invalid command %s.", qPrintable(commandName));
QCoreApplication app(argc, argv);
app.setApplicationVersion(KEEPASSX_VERSION);
// showHelp exits the application immediately, so we need to set the
// exit code here.
parser.showHelp(EXIT_FAILURE);
}
int exitCode = command->execute(argc, argv);
// Removing the first argument (keepassxc).
arguments.removeFirst();
int exitCode = command->execute(arguments);
#if defined(WITH_ASAN) && defined(WITH_LSAN)
// do leak check here to prevent massive tail of end-of-process leak errors from third-party libraries