✨✨ CLI Command cleanup ✨✨
This PR cleans up the `Command` classes in the CLI, introducing a `DatabaseCommand` class for the commands operating on a database, and a `getCommandLineParser` command to centralize the arguments parsing and validation. The opening of the database based on the CLI arguments and options is now centralized in `DatabaseCommand.execute`, making it easy to add new database opening features (like YubiKey support for the CLI). Also a couple of bugs fixed: * `Create` was still using `stdout` for some error messages. * `Diceware` and `Generate` were not validating that the word count was an integer. * `Diceware` was also using `stdout` for some error messages.
This commit is contained in:
@@ -18,17 +18,15 @@
|
||||
#ifndef KEEPASSXC_REMOVE_H
|
||||
#define KEEPASSXC_REMOVE_H
|
||||
|
||||
#include "Command.h"
|
||||
#include "DatabaseCommand.h"
|
||||
|
||||
#include "core/Database.h"
|
||||
|
||||
class Remove : public Command
|
||||
class Remove : public DatabaseCommand
|
||||
{
|
||||
public:
|
||||
Remove();
|
||||
~Remove();
|
||||
int execute(const QStringList& arguments) override;
|
||||
int removeEntry(Database* database, const QString& databasePath, const QString& entryPath, bool quiet);
|
||||
|
||||
int executeWithDatabase(QSharedPointer<Database> db, QSharedPointer<QCommandLineParser> parser);
|
||||
};
|
||||
|
||||
#endif // KEEPASSXC_REMOVE_H
|
||||
|
||||
Reference in New Issue
Block a user