|
BashSpark
|
Calls a function. More...
#include <command_fcall.h>


Public Member Functions | |
| command_fcall () | |
| Constructs command. | |
| shell_status | run (const std::span< const std::string > &vArgs, shell_session &oSession) const override |
| Prints on stdout the result of a mathematical operation. | |
| virtual void | msg_error_param_number (std::ostream &oStdErr, std::size_t nArgs) const |
| Print an error if the wrong number of arguments is provided. | |
| virtual void | msg_error_function_not_found (std::ostream &oStdErr, const std::string &sFunction) const |
| Displays the error message for function not found error. | |
Public Member Functions inherited from bs::command | |
| command (std::string sName) | |
| Construct a command with a given name. | |
| virtual | ~command ()=default |
| Virtual destructor. | |
| std::string | get_name () const |
| Get the command name (copy). | |
| const std::string & | get_name_ref () const noexcept |
| Get the command name (reference). | |
Calls a function.
Syntax: fcall funcion_name <args>
Possible errors:
bs::shell_status::SHELL_CMD_ERROR_FCALL_FUNCTION_NOT_FOUND: the function was not found.bs::shell_status::SHELL_CMD_ERROR_FCALL_PARAM_NUMBER: if there isn't at least one parameter.
|
virtual |
Displays the error message for function not found error.
Can be overwritten with custom behaviour.
| oStdErr | Error output stream |
| sFunction | Status code |
|
virtual |
Print an error if the wrong number of arguments is provided.
| oStdErr | Stream to print error message. |
| nArgs | Number of provided arguments. |
|
overridevirtual |
Prints on stdout the result of a mathematical operation.
| vArgs | Arguments for the command. |
| oSession | The shell session context. |
Implements bs::command.