Konsole::ShellCommand
#include <ShellCommand.h>
Public Member Functions | |
ShellCommand (const QString &aCommand) | |
ShellCommand (const QString &aCommand, const QStringList &aArguments) | |
QStringList | arguments () const |
QString | command () const |
QString | fullCommand () const |
Static Public Member Functions | |
static QString | expand (const QString &text) |
static QStringList | expand (const QStringList &items) |
static bool | isValidEnvCharacter (const QChar &ch) |
static bool | isValidLeadingEnvCharacter (const QChar &ch) |
Detailed Description
A class to parse and extract information about shell commands.
ShellCommand can be used to:
- Take a command-line (eg "/bin/sh -c /path/to/my/script") and split it into its component parts (eg. the command "/bin/sh" and the arguments "-c","/path/to/my/script")
- Take a command and a list of arguments and combine them to form a complete command line.
- Determine whether the binary specified by a command exists in the user's PATH.
- Determine whether a command-line specifies the execution of another command as the root user using su/sudo etc.
Definition at line 36 of file ShellCommand.h.
Constructor & Destructor Documentation
◆ ShellCommand() [1/2]
|
explicit |
Constructs a ShellCommand from a command line.
- Parameters
-
aCommand The command line to parse.
Definition at line 15 of file ShellCommand.cpp.
◆ ShellCommand() [2/2]
ShellCommand::ShellCommand | ( | const QString & | aCommand, |
const QStringList & | aArguments ) |
Constructs a ShellCommand with the specified aCommand
and aArguments
.
Definition at line 20 of file ShellCommand.cpp.
Member Function Documentation
◆ arguments()
QStringList ShellCommand::arguments | ( | ) | const |
Returns the arguments.
Definition at line 54 of file ShellCommand.cpp.
◆ command()
QString ShellCommand::command | ( | ) | const |
Returns the command.
Definition at line 46 of file ShellCommand.cpp.
◆ expand() [1/2]
Expands environment variables in text
.
Definition at line 71 of file ShellCommand.cpp.
◆ expand() [2/2]
|
static |
Expands environment variables in each string in list
.
Definition at line 59 of file ShellCommand.cpp.
◆ fullCommand()
QString ShellCommand::fullCommand | ( | ) | const |
Returns the full command line.
Definition at line 28 of file ShellCommand.cpp.
◆ isValidEnvCharacter()
|
static |
Definition at line 78 of file ShellCommand.cpp.
◆ isValidLeadingEnvCharacter()
|
static |
Definition at line 84 of file ShellCommand.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:55:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.