SVCS - English Documentation
Loading...
Searching...
No Matches
svcs::test::cli::HelpCommand Class Reference

Command for displaying help information about other commands. More...

#include <HelpCommand.hxx>

Inheritance diagram for svcs::test::cli::HelpCommand:
svcs::cli::ICommand

Public Member Functions

 HelpCommand (std::shared_ptr< ISubject > subject, std::shared_ptr< HelpService > helpService)
 Constructs the HelpCommand.
bool execute (const std::vector< std::string > &args) override
 Executes the help command logic.
std::string getName () const override
 Gets the name of the command.
std::string getDescription () const override
 Gets the brief description of the command.
std::string getUsage () const override
 Gets the usage syntax of the command.
void showHelp () const override
 Shows detailed help information for this specific command via the event bus.
Public Member Functions inherited from svcs::cli::ICommand
virtual ~ICommand ()=default
 Virtual destructor.

Detailed Description

Command for displaying help information about other commands.

The HelpCommand is the application's built-in help utility. It can show a general list of all available commands or display detailed usage and descriptions for a specific command provided as an argument. It delegates the retrieval of command information to the HelpService to maintain a clean separation of concerns.

Constructor & Destructor Documentation

◆ HelpCommand()

svcs::cli::HelpCommand::HelpCommand ( std::shared_ptr< ISubject > subject,
std::shared_ptr< HelpService > helpService )

Constructs the HelpCommand.

Parameters
subjectShared pointer to the event bus for logging and output notifications.
helpServiceShared pointer to the help service dependency.

Member Function Documentation

◆ execute()

bool svcs::cli::HelpCommand::execute ( const std::vector< std::string > & args)
overridevirtual

Executes the help command logic.

Parameters
argsCommand arguments. If the vector is empty, general help is shown. If it contains one command name, detailed help for that command is shown.
Returns
true always, as the help command is not expected to encounter a runtime failure.

Implements svcs::cli::ICommand.

◆ getDescription()

std::string svcs::cli::HelpCommand::getDescription ( ) const
nodiscardoverridevirtual

Gets the brief description of the command.

Returns
The string "Show help information for commands".

Implements svcs::cli::ICommand.

◆ getName()

std::string svcs::cli::HelpCommand::getName ( ) const
inlinenodiscardoverridevirtual

Gets the name of the command.

Returns
The string "help".

Implements svcs::cli::ICommand.

◆ getUsage()

std::string svcs::cli::HelpCommand::getUsage ( ) const
nodiscardoverridevirtual

Gets the usage syntax of the command.

Returns
The string "svcs help [command]".

Implements svcs::cli::ICommand.

◆ showHelp()

void svcs::cli::HelpCommand::showHelp ( ) const
overridevirtual

Shows detailed help information for this specific command via the event bus.

Implements svcs::cli::ICommand.


The documentation for this class was generated from the following files: