mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-26 07:49:50 -05:00
use default password lenght + minor fixes
This commit is contained in:
parent
27f8aa095a
commit
e9612ee9e6
@ -43,7 +43,7 @@ int Diceware::execute(QStringList arguments)
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription(this->description);
|
||||
QCommandLineOption wordlistFile(QStringList() << "w"
|
||||
<< "wordlist",
|
||||
<< "word-list",
|
||||
QObject::tr("Wordlist fot the diceware generator.\n[Default: EFF English]"),
|
||||
QObject::tr("path"));
|
||||
parser.addOption(wordlistFile);
|
||||
@ -68,7 +68,7 @@ int Diceware::execute(QStringList arguments)
|
||||
}
|
||||
|
||||
if (!dicewareGenerator.isValid()) {
|
||||
outputTextStream << parser.helpText().replace("keepassxc-cli", "keepassxc-cli passgen");
|
||||
outputTextStream << parser.helpText().replace("keepassxc-cli", "keepassxc-cli diceware");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,10 @@ int PassGen::execute(QStringList arguments)
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription(this->description);
|
||||
QCommandLineOption len(QStringList() << "L" << "length",
|
||||
QObject::tr("Length of the generated password."),
|
||||
QObject::tr("length"));
|
||||
parser.addOption(len);
|
||||
QCommandLineOption lower(QStringList() << "l",
|
||||
QObject::tr("Use lowercase in the generated password."));
|
||||
parser.addOption(lower);
|
||||
@ -57,19 +61,22 @@ int PassGen::execute(QStringList arguments)
|
||||
QCommandLineOption extended(QStringList() << "e",
|
||||
QObject::tr("Use extended ascii in the generated password."));
|
||||
parser.addOption(extended);
|
||||
parser.addPositionalArgument("length", QObject::tr("Length of the generated password."));
|
||||
parser.process(arguments);
|
||||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
if (args.size() != 1) {
|
||||
if (args.size() != 0) {
|
||||
outputTextStream << parser.helpText().replace("keepassxc-cli", "keepassxc-cli passgen");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
PasswordGenerator passwordGenerator;
|
||||
|
||||
int length = args.at(0).toInt();
|
||||
passwordGenerator.setLength(length);
|
||||
if (parser.value(len).isEmpty()) {
|
||||
passwordGenerator.setLength(PasswordGenerator::DefaultLength);
|
||||
} else {
|
||||
int length = parser.value(len).toInt();
|
||||
passwordGenerator.setLength(length);
|
||||
}
|
||||
|
||||
PasswordGenerator::CharClasses classes = 0x0;
|
||||
|
||||
|
@ -112,7 +112,7 @@ specified, a summary of the default attributes is given.
|
||||
|
||||
.SS "Diceware options"
|
||||
|
||||
.IP "-w, --wordlist <path>"
|
||||
.IP "-w, --word-list <path>"
|
||||
Path of the wordlist for the diceware generator. The wordlist must have > 1000 words,
|
||||
otherwise the program will fail. If the wordlist has < 4000 words a warning will
|
||||
be printed to STDERR.
|
||||
|
Loading…
Reference in New Issue
Block a user