SVCS - English Documentation
Loading...
Searching...
No Matches
InitCommand.hxx
Go to the documentation of this file.
1
13#pragma once
14
15#include "ICommand.hxx"
18
19#include <memory>
20#include <vector>
21#include <string>
22
36namespace svcs::cli {
37
38using namespace svcs::core;
39using namespace svcs::services;
40
42 * @english
43 * @brief Implements the "init" command for the Version Control System (VCS).
44 * @details This command is responsible for initializing a new SVCS repository in the
45 * current directory or a specified location, setting up the necessary
46 * internal structure (e.g., the hidden .svcs directory).
47 * The class inherits from ICommand, ensuring it adheres to the Command pattern
48 * interface. It requires an event bus for communication and a repository manager
49 * to perform the actual initialization logic.
50 *
51 * @russian
52 * @brief Реализует команду "init" для системы контроля версий (VCS).
53 * @details Эта команда отвечает за инициализацию нового репозитория SVCS в
54 * текущей директории или указанном местоположении, настраивая необходимую
55 * внутреннюю структуру (например, скрытую директорию .svcs).
56 * Класс наследуется от ICommand, обеспечивая соответствие интерфейсу шаблона Command.
57 * Он требует шину событий для связи и менеджер репозитория
58 * для выполнения фактической логики инициализации.
59 */
60class InitCommand : public ICommand {
61private:
69 std::shared_ptr<ISubject> eventBus_;
70
78 std::shared_ptr<RepositoryManager> repoManager_;
79
80public:
92 InitCommand(std::shared_ptr<ISubject> subject,
93 std::shared_ptr<RepositoryManager> repoManager);
94
103
110 bool execute(const std::vector<std::string>& args) override;
111
121 [[nodiscard]] std::string getName() const override;
122
132 [[nodiscard]] std::string getDescription() const override;
133
143 [[nodiscard]] std::string getUsage() const override;
144
152 void showHelp() const override;
153};
154
155}
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
InitCommand(std::shared_ptr< ISubject > subject, std::shared_ptr< RepositoryManager > repoManager)
Constructs an InitCommand.
Definition InitCommand.cxx:20
void showHelp() const override
Displays detailed help information about the command via the event bus.
Definition InitCommand.cxx:81
std::string getDescription() const override
Returns a brief description of the command's purpose.
Definition InitCommand.cxx:73
std::string getName() const override
Returns the command name.
Definition InitCommand.cxx:69
bool execute(const std::vector< std::string > &args) override
Executes the repository initialization logic.
Definition InitCommand.cxx:25
std::string getUsage() const override
Returns the usage syntax for the command.
Definition InitCommand.cxx:77
Command-line interface components and command implementations.