better commands

This commit is contained in:
2023-07-14 22:26:18 +02:00
parent f240c313a7
commit b0522a6871
17 changed files with 24 additions and 31 deletions

View File

@@ -14,14 +14,7 @@ public:
virtual void run(Context ctx) = 0;
/// Default virtual destructor
virtual ~Command() = 0;
/// The name of the command
const std::string name;
protected:
/// Constructs a command with name \p name
Command(std::string name);
virtual ~Command() = default;
};

View File

@@ -17,6 +17,7 @@ class CommandDiff : public Command {
public:
CommandDiff();
void run(Context ctx) override;
static constexpr std::string_view name{"diff"};
};

View File

@@ -14,6 +14,7 @@ class CommandList : public Command {
public:
CommandList();
void run(Context ctx) override;
static constexpr std::string_view name{"list"};
};

View File

@@ -14,6 +14,7 @@ class CommandListFiles : public Command {
public:
CommandListFiles();
void run(Context ctx) override;
static constexpr std::string_view name{"list-files"};
};

View File

@@ -11,6 +11,7 @@ class CommandMount : public Command {
public:
CommandMount();
void run(Context ctx) override;
static constexpr std::string_view name{"mount"};
};

View File

@@ -16,6 +16,7 @@ class CommandRestore : public Command {
public:
CommandRestore();
void run(Context ctx) override;
static constexpr std::string_view name{"restore"};
private:
/// Internal function to restore a file

View File

@@ -14,6 +14,7 @@ class CommandRun : public Command {
public:
CommandRun();
void run(Context ctx) override;
static constexpr std::string_view name{"run"};
private:
/// Internal function to chunk the file and save it