Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli/Command.h')
-rw-r--r--src/cli/Command.h32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/cli/Command.h b/src/cli/Command.h
index 30af61702..4381bf187 100644
--- a/src/cli/Command.h
+++ b/src/cli/Command.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ * Copyright (C) 2019 KeePassXC Team <team@keepassxc.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
#define KEEPASSXC_COMMAND_H
#include <QCommandLineOption>
+#include <QCommandLineParser>
#include <QList>
#include <QObject>
#include <QString>
@@ -26,21 +27,44 @@
#include "core/Database.h"
+// At the moment, there's no QT class for the positional arguments
+// like there is for the options (QCommandLineOption).
+struct CommandLineArgument
+{
+ QString name;
+ QString description;
+ QString syntax;
+};
+
class Command
{
public:
+ Command();
virtual ~Command();
virtual int execute(const QStringList& arguments) = 0;
QString name;
QString description;
- QString getDescriptionLine();
+ QSharedPointer<Database> currentDatabase;
+ QList<CommandLineArgument> positionalArguments;
+ QList<CommandLineArgument> optionalArguments;
+ QList<QCommandLineOption> options;
- static QList<Command*> getCommands();
- static Command* getCommand(const QString& commandName);
+ QString getDescriptionLine();
+ QSharedPointer<QCommandLineParser> getCommandLineParser(const QStringList& arguments);
+ QString getHelpText();
+ static const QCommandLineOption HelpOption;
static const QCommandLineOption QuietOption;
static const QCommandLineOption KeyFileOption;
static const QCommandLineOption NoPasswordOption;
+ static const QCommandLineOption YubiKeyOption;
};
+namespace Commands
+{
+ void setupCommands(bool interactive);
+ QList<QSharedPointer<Command>> getCommands();
+ QSharedPointer<Command> getCommand(const QString& commandName);
+} // namespace Commands
+
#endif // KEEPASSXC_COMMAND_H