|
| | shell_session (const shell *pShell, std::istream &oStdIn, std::ostream &oStdOut, std::ostream &oStdErr) |
| | Construct a new shell session with fresh env/var/arg.
|
| |
| | shell_session (const shell *pBash, std::istream &oStdIn, std::ostream &oStdOut, std::ostream &oStdErr, shell_env oEnv, shell_arg oArg) |
| | Construct a new shell session providing initial env and args.
|
| |
|
virtual | ~shell_session ()=default |
| | Virtual destructor for subclassing.
|
| |
| const shell * | get_shell () const noexcept |
| | Get the pointer to the underlying shell.
|
| |
|
shell_env & | env () noexcept |
| | Get modifiable environment.
|
| |
|
const shell_env & | env () const noexcept |
| | Get const environment.
|
| |
| bool | has_env (const std::string &sVariable) const noexcept |
| | Check whether an environment variable exists.
|
| |
| std::string | get_env (const std::string &sVariable) const |
| | Retrieve an environment variable.
|
| |
| std::string | get_env_hop2 (const std::string &sVariable) const |
| | Retrieve an environment variable using hop-2 resolution.
|
| |
| void | set_env (const std::string &sVariable, std::string sValue) |
| | Set an environment variable.
|
| |
|
const shell_var & | var () const noexcept |
| | Get const variable table.
|
| |
|
shell_var & | var () noexcept |
| | Get modifiable variable table.
|
| |
| bool | has_var (const std::string &sVariable) const noexcept |
| | Check whether a local variable exists.
|
| |
| std::string | get_var (const std::string &sVariable) const |
| | Retrieve a local variable.
|
| |
| std::string | get_var_hop2 (const std::string &sVariable) const |
| | Retrieve a local variable using hop-2 resolution.
|
| |
| void | set_var (const std::string &sVariable, std::string sValue) |
| | Set a local variable.
|
| |
|
const shell_arg & | arg () const noexcept |
| | Get const argument list.
|
| |
|
shell_arg & | arg () noexcept |
| | Get modifiable argument list.
|
| |
| std::string | get_arg (const std::size_t nArg) const |
| | Retrieve a specific argument.
|
| |
|
std::size_t | get_arg_size () const |
| | Get number of arguments.
|
| |
| const std::vector< std::string > & | get_args () const noexcept |
| | Get the full argument list.
|
| |
|
std::istream & | in () const noexcept |
| | Get stdin stream.
|
| |
|
std::ostream & | out () const noexcept |
| | Get stdout stream.
|
| |
|
std::ostream & | err () const noexcept |
| | Get stderr stream.
|
| |
|
shell_status | get_last_command_result () const noexcept |
| | Get status of last executed command.
|
| |
|
void | set_last_command_result (const shell_status nLastCommandResult) noexcept |
| | Set status of last executed command.
|
| |
| virtual std::unique_ptr< shell_session > | make_subsession (std::istream &oStdIn, std::ostream &oStdOut, std::ostream &oStdErr) |
| | Create a subsession with fresh streams but copied env/args/vars.
|
| |
| virtual std::unique_ptr< shell_session > | make_function_call (shell_arg oArg) |
| | Create a session for function calls.
|
| |
| virtual std::unique_ptr< shell_session > | make_pipe_left (std::ostringstream &oStdOut) |
| | Create a session representing the left side of a pipe.
|
| |
| virtual std::unique_ptr< shell_session > | make_pipe_right (std::istringstream &oStdIn) |
| | Create a session representing the right side of a pipe.
|
| |
| const func_type * | get_func (const std::string &sVar) const |
| | Gets a function.
|
| |
| void | set_func (const std::string &sName, const func_type *pFunction) |
| | Sets the a function.
|
| |
| bool | has_func (const std::string &sName) const noexcept |
| | Checks if a function exists.
|
| |
| std::size_t | get_vtable_size () const noexcept |
| | Gets the number of functions in the vtable.
|
| |
| std::size_t | get_current_shell_depth () const noexcept |
| | Gets the current shell depth.
|
| |
|
void | decrease_shell_depth () noexcept |
| | Decreases the current shell depth.
|
| |
| bool | increase_shell_depth () noexcept |
| | Tries to increase the shell depth.
|
| |
Represents an execution environment for a shell instance.
A shell_session encapsulates the streams (stdin/stdout/stderr), the environment variables (shell_env), local shell variables (shell_var), and argument lists (shell_arg) used by the running shell.
It provides the interface for creating subsessions, function-call sessions, and pipe-left/right sessions.