Feature : clip command (#578)

This commit is contained in:
louib 2017-05-19 14:04:11 -04:00 committed by GitHub
parent 6c050c55d9
commit a2e82dc883
15 changed files with 250 additions and 41 deletions

View file

@ -30,16 +30,15 @@
#include "core/Group.h"
#include "keys/CompositeKey.h"
int Show::execute(int argc, char **argv)
int Show::execute(int argc, char** argv)
{
QCoreApplication app(argc, argv);
QTextStream out(stdout);
QCommandLineParser parser;
parser.setApplicationDescription(QCoreApplication::translate("main",
"Show a password."));
parser.setApplicationDescription(QCoreApplication::translate("main", "Show a password."));
parser.addPositionalArgument("database", QCoreApplication::translate("main", "Path of the database."));
parser.addPositionalArgument("uuid", QCoreApplication::translate("main", "Uuid of the entry to show"));
parser.addPositionalArgument("entry", QCoreApplication::translate("main", "Name of the entry to show."));
parser.process(app);
const QStringList args = parser.positionalArguments();
@ -60,10 +59,10 @@ int Show::execute(int argc, char **argv)
return EXIT_FAILURE;
}
Uuid uuid = Uuid::fromHex(args.at(1));
Entry* entry = db->resolveEntry(uuid);
if (entry == nullptr) {
qCritical("No entry found with uuid %s", qPrintable(uuid.toHex()));
QString entryId = args.at(1);
Entry* entry = db->rootGroup()->findEntry(entryId);
if (!entry) {
qCritical("Entry %s not found.", qPrintable(entryId));
return EXIT_FAILURE;
}