SVCS - English Documentation
Loading...
Searching...
No Matches
UndoCommand.hxx
Go to the documentation of this file.
1
22#pragma once
23
24#include "ICommand.hxx"
27
28#include <memory>
29#include <string>
30#include <vector>
31
44 */
45namespace svcs::cli {
46
47using namespace svcs::core;
48
64class UndoCommand : public ICommand {
65public:
77 UndoCommand(std::shared_ptr<ISubject> subject,
78 std::shared_ptr<RepositoryManager> repoManager);
79
95 bool execute(const std::vector<std::string>& args) override;
96
106 [[nodiscard]] std::string getName() const override;
107
117 [[nodiscard]] std::string getDescription() const override;
118
128 [[nodiscard]] std::string getUsage() const override;
129
137 void showHelp() const override;
138
139private:
141
151 bool undoLastCommit(bool force) const;
152
166 bool undoSpecificCommit(const std::string& commitHash, bool force) const;
167
185 static bool confirmUndo(const std::string& commitMessage, const std::string& commitHash, bool force);
186
196 bool forceResetRepository() const;
197
198private:
206 std::shared_ptr<ISubject> event_bus;
207
215 std::shared_ptr<RepositoryManager> repo_manager;
216};
217
218}
Declaration of the ICommand interface for all executable CLI commands.
Defines the interface for the Subject (Publisher) component of the Observer pattern.
Declaration of the RepositoryManager class, managing all repository-level file operations.
Interface (abstract base class) for all commands executed via the CLI.
Definition ICommand.hxx:34
std::string getName() const override
Gets the command's primary name.
Definition UndoCommand.cxx:27
void showHelp() const override
Displays detailed help information for the command.
Definition UndoCommand.cxx:265
std::string getDescription() const override
Gets the short description of the command.
Definition UndoCommand.cxx:31
bool execute(const std::vector< std::string > &args) override
Executes the undo command based on the provided arguments.
Definition UndoCommand.cxx:39
std::string getUsage() const override
Gets the usage syntax of the command.
Definition UndoCommand.cxx:35
UndoCommand(std::shared_ptr< ISubject > subject, std::shared_ptr< RepositoryManager > repoManager)
Constructor for UndoCommand.
Definition UndoCommand.cxx:22
Command-line interface components and command implementations.
Core VCS data structures and object model.