63 std::shared_ptr<ISubject> eventBus_;
74 std::function<std::vector<std::string>()> getCommandsCallback_;
83 std::function<std::string(
const std::string&)> getDescriptionCallback_;
92 std::function<void(
const std::string&)> showHelpCallback_;
101 std::function<std::string(
const std::string&)> getUsageCallback_;
122 std::function<std::vector<std::string>()> getCommands,
123 std::function<std::string(
const std::string&)> getDescription,
124 std::function<
void(
const std::string&)> showHelp,
125 std::function<std::string(
const std::string&)> getUsage =
nullptr);
173 [[nodiscard]]
bool commandExists(
const std::string& commandName)
const;
186 [[nodiscard]] std::string
getCommandUsage(
const std::string& commandName)
const;
Определяет интерфейс для компонента Subject (Издатель) шаблона Observer.
HelpService(std::shared_ptr< ISubject > bus, std::function< std::vector< std::string >()> getCommands, std::function< std::string(const std::string &)> getDescription, std::function< void(const std::string &)> showHelp, std::function< std::string(const std::string &)> getUsage=nullptr)
Конструирует HelpService путем внедрения необходимых зависимостей в виде обратных вызовов.
Определения HelpService.cxx:21
std::vector< std::string > getAvailableCommands() const
Выполняет getCommandsCallback_ для получения списка всех доступных имен команд.
Определения HelpService.cxx:33
void showCommandHelp(const std::string &commandName) const
Выполняет showHelpCallback_ для запуска отображения подробной справки для конкретной команды.
Определения HelpService.cxx:47
bool commandExists(const std::string &commandName) const
Проверяет существование команды путем сравнения со списком, возвращенным getAvailableCommands.
Определения HelpService.cxx:56
std::string getCommandUsage(const std::string &commandName) const
Выполняет getUsageCallback_ для получения синтаксиса использования конкретной команды.
Определения HelpService.cxx:61
std::string getCommandDescription(const std::string &commandName) const
Выполняет getDescriptionCallback_ для получения краткого описания конкретной команды.
Определения HelpService.cxx:40
Компоненты командной строки и реализации команд.
Компоненты сервисного слоя и инфраструктурные сервисы.