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

Represents a command line argument list for shell commands. More...

#include <shell_arg.h>

Public Member Functions

 shell_arg ()=default
 Default constructor (no args)
 
 shell_arg (std::vector< std::string > &&vArgVariables)
 Constructs an shell_arg object with command-line arguments.
 
std::string get_arg (const std::size_t nArg) const
 Retrieves a command-line argument by its index.
 
bool has_arg (const std::size_t nArg) const noexcept
 Checks if a command-line argument exists at the given index.
 
std::size_t get_arg_size () const noexcept
 Gets the number of command-line arguments.
 
const std::vector< std::string > & get_args () const noexcept
 Retrieves all command-line arguments.
 

Detailed Description

Represents a command line argument list for shell commands.

This class manages command-line arguments.

Constructor & Destructor Documentation

◆ shell_arg()

bs::shell_arg::shell_arg ( std::vector< std::string > &&  vArgVariables)
inlineexplicit

Constructs an shell_arg object with command-line arguments.

Parameters
vArgVariablesA vector containing command-line arguments.

Member Function Documentation

◆ get_arg()

std::string bs::shell_arg::get_arg ( const std::size_t  nArg) const
inline

Retrieves a command-line argument by its index.

Parameters
nArgThe index of the argument.
Returns
The argument as a string, or an empty string if out of range.

◆ get_arg_size()

std::size_t bs::shell_arg::get_arg_size ( ) const
inlinenoexcept

Gets the number of command-line arguments.

Returns
The size of the arguments vector.

◆ get_args()

const std::vector< std::string > & bs::shell_arg::get_args ( ) const
inlinenoexcept

Retrieves all command-line arguments.

Returns
A const reference to the vector of command-line arguments.

◆ has_arg()

bool bs::shell_arg::has_arg ( const std::size_t  nArg) const
inlinenoexcept

Checks if a command-line argument exists at the given index.

Parameters
nArgThe index of the argument.
Returns
True if the argument exists, false otherwise.

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