51 explicit shell_arg(std::vector<std::string> &&vArgVariables)
52 : m_vArgVariables(std::move(vArgVariables)) {
61 [[nodiscard]] std::string
get_arg(
const std::size_t nArg)
const {
62 return nArg < this->m_vArgVariables.size() ? m_vArgVariables.at(nArg) :
"";
70 [[nodiscard]]
bool has_arg(
const std::size_t nArg)
const noexcept {
71 return nArg < this->m_vArgVariables.size();
79 return this->m_vArgVariables.size();
86 [[nodiscard]]
const std::vector<std::string> &
get_args() const noexcept {
87 return this->m_vArgVariables;
92 std::vector<std::string> m_vArgVariables;
Represents a command line argument list for shell commands.
Definition shell_arg.h:42
bool has_arg(const std::size_t nArg) const noexcept
Checks if a command-line argument exists at the given index.
Definition shell_arg.h:70
shell_arg(std::vector< std::string > &&vArgVariables)
Constructs an shell_arg object with command-line arguments.
Definition shell_arg.h:51
const std::vector< std::string > & get_args() const noexcept
Retrieves all command-line arguments.
Definition shell_arg.h:86
std::size_t get_arg_size() const noexcept
Gets the number of command-line arguments.
Definition shell_arg.h:78
std::string get_arg(const std::size_t nArg) const
Retrieves a command-line argument by its index.
Definition shell_arg.h:61
shell_arg()=default
Default constructor (no args)
BashSpark main namespace.
Definition command.h:39