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

Built-in command that evaluates its arguments as a shell command. More...

#include <command.h>

Inheritance diagram for bs::command_eval:
Collaboration diagram for bs::command_eval:

Public Member Functions

 command_eval ()
 Constructs the command.
 
shell_status run (const std::span< const std::string > &vArgs, shell_session &oSession) const override
 Execute the provided arguments as if typed in shell. The corresponding status code is returned.
 
- 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).
 

Protected Member Functions

virtual void msg_error_max_depth_reached (std::ostream &oStdErr) const
 Print an error if the depth limit of the shell is surpassed.
 

Detailed Description

Built-in command that evaluates its arguments as a shell command.

Executes the provided string(s) as if typed in the shell. This command allows dynamic command execution at runtime.

Member Function Documentation

◆ msg_error_max_depth_reached()

void bs::command_eval::msg_error_max_depth_reached ( std::ostream &  oStdErr) const
protectedvirtual

Print an error if the depth limit of the shell is surpassed.

Parameters
oStdErrStream to print error message.

◆ run()

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

Execute the provided arguments as if typed in shell. The corresponding status code is returned.

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: