Formatting the code.

This commit is contained in:
Louis-Bertrand Varin 2018-03-31 16:01:30 -04:00
parent 74efc57369
commit 8324d03f0a
294 changed files with 3796 additions and 3740 deletions

View file

@ -42,14 +42,15 @@ int Diceware::execute(const QStringList& arguments)
QCommandLineParser parser;
parser.setApplicationDescription(this->description);
QCommandLineOption words(QStringList() << "W" << "words",
QObject::tr("Word count for the diceware passphrase."),
QObject::tr("count"));
QCommandLineOption words(QStringList() << "W"
<< "words",
QObject::tr("Word count for the diceware passphrase."),
QObject::tr("count"));
parser.addOption(words);
QCommandLineOption wordlistFile(QStringList() << "w"
<< "word-list",
QObject::tr("Wordlist for the diceware generator.\n[Default: EFF English]"),
QObject::tr("path"));
<< "word-list",
QObject::tr("Wordlist for the diceware generator.\n[Default: EFF English]"),
QObject::tr("path"));
parser.addOption(wordlistFile);
parser.process(arguments);
@ -78,7 +79,7 @@ int Diceware::execute(const QStringList& arguments)
outputTextStream << parser.helpText().replace("keepassxc-cli", "keepassxc-cli diceware");
return EXIT_FAILURE;
}
QString password = dicewareGenerator.generatePassphrase();
outputTextStream << password << endl;

View file

@ -115,8 +115,9 @@ int Edit::execute(const QStringList& arguments)
return EXIT_FAILURE;
}
if (parser.value("username").isEmpty() && parser.value("url").isEmpty() && parser.value("title").isEmpty() &&
!parser.isSet(prompt) && !parser.isSet(generate)) {
if (parser.value("username").isEmpty() && parser.value("url").isEmpty() && parser.value("title").isEmpty()
&& !parser.isSet(prompt)
&& !parser.isSet(generate)) {
qCritical("Not changing any field for entry %s.", qPrintable(entryPath));
return EXIT_FAILURE;
}

View file

@ -84,8 +84,8 @@ int Extract::execute(const QStringList& arguments)
if (fileKey.type() != FileKey::Hashed) {
errorTextStream << QObject::tr("WARNING: You are using a legacy key file format which may become\n"
"unsupported in the future.\n\n"
"Please consider generating a new key file.");
"unsupported in the future.\n\n"
"Please consider generating a new key file.");
errorTextStream << endl;
}

View file

@ -42,24 +42,20 @@ int Generate::execute(const QStringList& arguments)
QCommandLineParser parser;
parser.setApplicationDescription(this->description);
QCommandLineOption len(QStringList() << "L" << "length",
QObject::tr("Length of the generated password."),
QObject::tr("length"));
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 characters in the generated password."));
QCommandLineOption lower(QStringList() << "l", QObject::tr("Use lowercase characters in the generated password."));
parser.addOption(lower);
QCommandLineOption upper(QStringList() << "u",
QObject::tr("Use uppercase characters in the generated password."));
QCommandLineOption upper(QStringList() << "u", QObject::tr("Use uppercase characters in the generated password."));
parser.addOption(upper);
QCommandLineOption numeric(QStringList() << "n",
QObject::tr("Use numbers in the generated password."));
QCommandLineOption numeric(QStringList() << "n", QObject::tr("Use numbers in the generated password."));
parser.addOption(numeric);
QCommandLineOption special(QStringList() << "s",
QObject::tr("Use special characters in the generated password."));
QCommandLineOption special(QStringList() << "s", QObject::tr("Use special characters in the generated password."));
parser.addOption(special);
QCommandLineOption extended(QStringList() << "e",
QObject::tr("Use extended ASCII in the generated password."));
QCommandLineOption extended(QStringList() << "e", QObject::tr("Use extended ASCII in the generated password."));
parser.addOption(extended);
parser.process(arguments);
@ -81,19 +77,19 @@ int Generate::execute(const QStringList& arguments)
PasswordGenerator::CharClasses classes = 0x0;
if (parser.isSet(lower)) {
classes |= PasswordGenerator::LowerLetters;
classes |= PasswordGenerator::LowerLetters;
}
if (parser.isSet(upper)) {
classes |= PasswordGenerator::UpperLetters;
classes |= PasswordGenerator::UpperLetters;
}
if (parser.isSet(numeric)) {
classes |= PasswordGenerator::Numbers;
classes |= PasswordGenerator::Numbers;
}
if (parser.isSet(special)) {
classes |= PasswordGenerator::SpecialCharacters;
classes |= PasswordGenerator::SpecialCharacters;
}
if (parser.isSet(extended)) {
classes |= PasswordGenerator::EASCII;
classes |= PasswordGenerator::EASCII;
}
passwordGenerator.setCharClasses(classes);

View file

@ -49,12 +49,14 @@ int Show::execute(const QStringList& arguments)
QObject::tr("Key file of the database."),
QObject::tr("path"));
parser.addOption(keyFile);
QCommandLineOption attributes(QStringList() << "a"
<< "attributes",
QObject::tr("Names of the attributes to show. "
"This option can be specified more than once, with each attribute shown one-per-line in the given order. "
"If no attributes are specified, a summary of the default attributes is given."),
QObject::tr("attribute"));
QCommandLineOption attributes(
QStringList() << "a"
<< "attributes",
QObject::tr(
"Names of the attributes to show. "
"This option can be specified more than once, with each attribute shown one-per-line in the given order. "
"If no attributes are specified, a summary of the default attributes is given."),
QObject::tr("attribute"));
parser.addOption(attributes);
parser.addPositionalArgument("entry", QObject::tr("Name of the entry to show."));
parser.process(arguments);