BashSpark
Loading...
Searching...
No Matches
bs::command_fcall Class Reference

Calls a function. More...

#include <command_fcall.h>

Inheritance diagram for bs::command_fcall:
Collaboration diagram for bs::command_fcall:

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).
 

Detailed Description

Calls a function.

Syntax: fcall funcion_name <args>

Possible errors:

Member Function Documentation

◆ msg_error_function_not_found()

void bs::command_fcall::msg_error_function_not_found ( std::ostream &  oStdErr,
const std::string &  sFunction 
) const
virtual

Displays the error message for function not found error.

Can be overwritten with custom behaviour.

Parameters
oStdErrError output stream
sFunctionStatus code

◆ msg_error_param_number()

void bs::command_fcall::msg_error_param_number ( std::ostream &  oStdErr,
std::size_t  nArgs 
) const
virtual

Print an error if the wrong number of arguments is provided.

Parameters
oStdErrStream to print error message.
nArgsNumber of provided arguments.

◆ run()

shell_status bs::command_fcall::run ( const std::span< const std::string > &  vArgs,
shell_session oSession 
) const
overridevirtual

Prints on stdout the result of a mathematical operation.

Parameters
vArgsArguments for the command.
oSessionThe shell session context.
Returns
Status of command execution.

Implements bs::command.


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