mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-01-08 12:05:54 -05:00
Adding --no-password option to CLI
I also added tests for the --key-file option, which was untested.
This commit is contained in:
parent
a58e3d5ee0
commit
13a9ac8f57
20 changed files with 146 additions and 20 deletions
|
|
@ -52,6 +52,7 @@ int Merge::execute(const QStringList& arguments)
|
|||
QObject::tr("Use the same credentials for both database files."));
|
||||
parser.addOption(samePasswordOption);
|
||||
parser.addOption(Command::KeyFileOption);
|
||||
parser.addOption(Command::NoPasswordOption);
|
||||
|
||||
QCommandLineOption keyFileFromOption(QStringList() << "f"
|
||||
<< "key-file-from",
|
||||
|
|
@ -59,6 +60,10 @@ int Merge::execute(const QStringList& arguments)
|
|||
QObject::tr("path"));
|
||||
parser.addOption(keyFileFromOption);
|
||||
|
||||
QCommandLineOption noPasswordFromOption(QStringList() << "no-password-from",
|
||||
QObject::tr("Deactivate password key for the database to merge from."));
|
||||
parser.addOption(noPasswordFromOption);
|
||||
|
||||
parser.addHelpOption();
|
||||
parser.process(arguments);
|
||||
|
||||
|
|
@ -69,6 +74,7 @@ int Merge::execute(const QStringList& arguments)
|
|||
}
|
||||
|
||||
auto db1 = Utils::unlockDatabase(args.at(0),
|
||||
!parser.isSet(Command::NoPasswordOption),
|
||||
parser.value(Command::KeyFileOption),
|
||||
parser.isSet(Command::QuietOption) ? Utils::DEVNULL : Utils::STDOUT,
|
||||
Utils::STDERR);
|
||||
|
|
@ -79,6 +85,7 @@ int Merge::execute(const QStringList& arguments)
|
|||
QSharedPointer<Database> db2;
|
||||
if (!parser.isSet("same-credentials")) {
|
||||
db2 = Utils::unlockDatabase(args.at(1),
|
||||
!parser.isSet(noPasswordFromOption),
|
||||
parser.value(keyFileFromOption),
|
||||
parser.isSet(Command::QuietOption) ? Utils::DEVNULL : Utils::STDOUT,
|
||||
Utils::STDERR);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue