101 static std::shared_ptr<Repository>
createRepository(
const std::string& path =
".") {
102 return std::make_shared<Repository>(path);
137 virtual std::string
getName()
const override = 0;
159 virtual std::string
getUsage()
const override = 0;
171 std::cout <<
"Usage: " <<
getUsage() << std::endl;
184 void logDebug(
const std::string& message)
const {
200 void logInfo(
const std::string& message)
const {
215 void logError(
const std::string& message)
const {
230 void logSuccess(
const std::string& message)
const {
245 void logWarning(
const std::string& message)
const {
Declaration of the ICommand interface for all executable CLI commands.
Manages the entire version control repository, acts as a Subject for event logging,...
BaseCommand(std::shared_ptr< ISubject > subject)
Constructor.
Definition BaseCommand.hxx:78
static std::shared_ptr< Repository > createRepository(const std::string &path=".")
Creates a new repository instance.
Definition BaseCommand.hxx:68
void logSuccess(const std::string &message) const
Generates a successful execution event (GENERAL_INFO with SUCCESS prefix).
Definition BaseCommand.hxx:157
virtual std::string getUsage() const override=0
Gets the command's usage syntax.
virtual std::string getDescription() const override=0
Gets a brief description of the command.
virtual std::string getName() const override=0
Gets the command name (e.g., "init", "commit").
void logDebug(const std::string &message) const
Generates a debug information event (DEBUG_MESSAGE).
Definition BaseCommand.hxx:123
void logInfo(const std::string &message) const
Generates a general informational event (GENERAL_INFO).
Definition BaseCommand.hxx:135
void showHelp() const override
Displays the command's help (Usage and Description).
Definition BaseCommand.hxx:113
void logError(const std::string &message) const
Generates a runtime error event (RUNTIME_ERROR).
Definition BaseCommand.hxx:146
static std::shared_ptr< Repository > findRepository()
Finds an existing repository in the current or parent directories.
Definition BaseCommand.hxx:58
std::shared_ptr< ISubject > eventSubject_
The Event Subject (Event Bus) instance.
Definition BaseCommand.hxx:51
void logWarning(const std::string &message) const
Generates a warning event (RUNTIME_ERROR with WARNING prefix).
Definition BaseCommand.hxx:168
~BaseCommand() override=default
Virtual destructor.
Interface (abstract base class) for all commands executed via the CLI.
Definition ICommand.hxx:34
static std::shared_ptr< Repository > findRepository(const std::string &start_path=".")
Statically searches for an existing repository starting from a given path and moving up.
Definition Repository.cxx:167
The Subject (Publisher) Interface (Abstract Base Class).
Definition ISubject.hxx:38
Command-line interface components and command implementations.
Core VCS data structures and object model.
@ DEBUG_MESSAGE
Debug message for development purposes.
Definition Event.hxx:106
@ RUNTIME_ERROR
Runtime error that may allow continued execution.
Definition Event.hxx:46
@ GENERAL_INFO
General informational message.
Definition Event.hxx:94