|
BashSpark
|
Abstract base class for all shell commands. More...
#include <command.h>

Public Member Functions | |
| command (std::string sName) | |
| Construct a command with a given name. | |
| virtual | ~command ()=default |
| Virtual destructor. | |
| virtual shell_status | run (const std::span< const std::string > &vArgs, shell_session &oSession) const =0 |
| Execute the command. | |
| std::string | get_name () const |
| Get the command name (copy). | |
| const std::string & | get_name_ref () const noexcept |
| Get the command name (reference). | |
Friends | |
| class | shell |
Abstract base class for all shell commands.
Encapsulates a shell command's identity and execution interface. Every command must implement run() to perform its action. Commands may be extended to provide custom error reporting.
|
inlineexplicit |
Construct a command with a given name.
| sName | The command's name. |
|
inline |
Get the command name (copy).
|
inlinenoexcept |
Get the command name (reference).
|
pure virtual |
Execute the command.
| vArgs | Arguments for the command. |
| oSession | The shell session context. |
Implemented in bs::command_echo, bs::command_eval, bs::command_getenv, bs::command_setenv, bs::command_fcall, bs::command_math, bs::command_seq, bs::command_test, bs::command_getvar, and bs::command_setvar.