37using namespace svcs::services;
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;
Defines the interface for the Subject (Publisher) component of the Observer pattern.
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)
Constructs the HelpService by injecting necessary dependencies as callbacks.
Definition HelpService.cxx:22
std::vector< std::string > getAvailableCommands() const
Executes the getCommandsCallback_ to retrieve the list of all available command names.
Definition HelpService.cxx:34
void showCommandHelp(const std::string &commandName) const
Executes the showHelpCallback_ to trigger the display of detailed help for a specific command.
Definition HelpService.cxx:48
bool commandExists(const std::string &commandName) const
Checks for the existence of a command by comparing against the list returned by getAvailableCommands.
Definition HelpService.cxx:57
std::string getCommandUsage(const std::string &commandName) const
Executes the getUsageCallback_ to retrieve the usage syntax of a specific command.
Definition HelpService.cxx:62
std::string getCommandDescription(const std::string &commandName) const
Executes the getDescriptionCallback_ to retrieve the brief description of a specific command.
Definition HelpService.cxx:41
Command-line interface components and command implementations.