SVCS - Русская документация
Загрузка...
Поиск...
Не найдено
SaveCommand.hxx
См. документацию.
1
13#pragma once
14
15#include "ICommand.hxx"
18
19#include <memory>
20#include <vector>
21#include <string>
22
34 * включая AddCommand, CommitCommand, StatusCommand и другие.
35 */
36namespace svcs::cli {
37
38using namespace svcs::core;
39
51class SaveCommand : public ICommand {
52private:
60 std::shared_ptr<ISubject> eventBus_;
61
69 std::shared_ptr<RepositoryManager> repoManager_;
70
71public:
83 SaveCommand(std::shared_ptr<ISubject> subject,
84 std::shared_ptr<RepositoryManager> repoManager);
85
97 bool execute(const std::vector<std::string>& args) override;
98
108 [[nodiscard]] std::string getName() const override { return "save"; }
109
113
119 [[nodiscard]] std::string getDescription() const override;
120
130 [[nodiscard]] std::string getUsage() const override;
131
139 void showHelp() const override;
140
141private:
153 [[nodiscard]] static std::string parseMessage(const std::vector<std::string>& args);
154
166 [[nodiscard]] bool validateMessage(const std::string& message) const;
167
177 [[nodiscard]] bool hasStagedChanges() const;
178
190 [[nodiscard]] bool createSavePoint(const std::string& message) const;
191};
192
193}
Объявление интерфейса ICommand для всех исполняемых CLI команд.
Определяет интерфейс для компонента Subject (Издатель) шаблона Observer.
Declaration of the RepositoryManager class, managing all repository-level file operations.
Интерфейс (абстрактный базовый класс) для всех команд, выполняемых через CLI.
Определения ICommand.hxx:31
std::string getName() const override
Получает имя команды.
Определения SaveCommand.hxx:66
SaveCommand(std::shared_ptr< ISubject > subject, std::shared_ptr< RepositoryManager > repoManager)
Конструирует SaveCommand.
Определения SaveCommand.cxx:20
void showHelp() const override
Показывает подробную справочную информацию для этой команды.
Определения SaveCommand.cxx:79
std::string getUsage() const override
Получает синтаксис использования команды.
Определения SaveCommand.cxx:75
bool execute(const std::vector< std::string > &args) override
Выполняет команду save.
Определения SaveCommand.cxx:25
std::string getDescription() const override
Получает описание команды.
Определения SaveCommand.cxx:71
Компоненты командной строки и реализации команд.
Основные структуры данных СКВ и модель объектов.