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

Built-in command that prints all arguments to stdout. More...

#include <command.h>

Inheritance diagram for bs::command_echo:
Collaboration diagram for bs::command_echo:

Public Member Functions

 command_echo ()
 Constructs the command.
 
shell_status run (const std::span< const std::string > &vArgs, shell_session &oSession) const override
 Prints all arguments to stdout.
 
- 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

Built-in command that prints all arguments to stdout.

Syntax: echo [argument]?+ (with new line)
Syntax: echo -n [argument]?+ (without new line)

Member Function Documentation

◆ run()

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

Prints all arguments to stdout.

Arguments are printed separated by a single space. Supports any number of arguments. No formatting or escape sequences are processed.

Option -n as first parameter disables '
' at the end of output.

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: