20#include <unordered_map>
40using namespace svcs::core;
66 std::shared_ptr<ISubject> event_bus;
75 std::shared_ptr<RepositoryManager> repo_manager;
90 std::unordered_map<std::string,
91 std::function<std::unique_ptr<ICommand>(std::shared_ptr<ISubject>,
92 std::shared_ptr<RepositoryManager>)>> creators;
103 void registerDefaultCommands();
118 std::shared_ptr<RepositoryManager> repoManager);
150 std::function<std::unique_ptr<ICommand>(std::shared_ptr<ISubject>,
151 std::shared_ptr<RepositoryManager>)> creator);
194 std::unique_ptr<ICommand>
createCommand(
const std::string& name)
const;
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.
void registerCommand(const std::string &name, std::function< std::unique_ptr< ICommand >(std::shared_ptr< ISubject >, std::shared_ptr< RepositoryManager >)> creator)
Registers a creator function for a new command.
Definition CommandFactory.cxx:164
std::string getCommandDescription(const std::string &name) const
Retrieves the brief description for a registered command.
Definition CommandFactory.cxx:147
CommandFactory & operator=(const CommandFactory &)=delete
Deletes the assignment operator. The Factory should not be assigned.
std::unique_ptr< ICommand > createCommand(const std::string &name) const
Creates and returns a command object by its name.
Definition CommandFactory.cxx:171
std::vector< std::string > getRegisteredCommands() const
Retrieves a list of names for all currently registered commands.
Definition CommandFactory.cxx:182
CommandFactory(std::shared_ptr< ISubject > bus, std::shared_ptr< RepositoryManager > repoManager)
Constructs the CommandFactory.
Definition CommandFactory.cxx:41
void showCommandHelp(const std::string &name) const
Displays the detailed help and usage for a registered command.
Definition CommandFactory.cxx:154
Command-line interface components and command implementations.