Konsole
Konsole::ShellCommand Class Reference
#include <ShellCommand.h>
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 50 of file ShellCommand.h.
Public Member Functions | |
QStringList | arguments () const |
QString | command () const |
QString | fullCommand () const |
bool | isAvailable () const |
bool | isRootCommand () const |
ShellCommand (const QString &command, const QStringList &arguments) | |
ShellCommand (const QString &fullCommand) | |
Static Public Member Functions | |
static QStringList | expand (const QStringList &items) |
static QString | expand (const QString &text) |
Constructor & Destructor Documentation
ShellCommand::ShellCommand | ( | const QString & | fullCommand | ) |
Constructs a ShellCommand from a command line.
- Parameters:
-
fullCommand The command line to parse.
Definition at line 32 of file ShellCommand.cpp.
ShellCommand::ShellCommand | ( | const QString & | command, | |
const QStringList & | arguments | |||
) |
Constructs a ShellCommand with the specified command
and arguments
.
Definition at line 60 of file ShellCommand.cpp.
Member Function Documentation
QStringList ShellCommand::arguments | ( | ) | const |
QString ShellCommand::command | ( | ) | const |
QStringList ShellCommand::expand | ( | const QStringList & | items | ) | [static] |
Expands environment variables in each string in list
.
Definition at line 92 of file ShellCommand.cpp.
QString ShellCommand::fullCommand | ( | ) | const |
bool ShellCommand::isAvailable | ( | ) | const |
Returns true if the program specified by command()
exists.
Definition at line 87 of file ShellCommand.cpp.
bool ShellCommand::isRootCommand | ( | ) | const |
The documentation for this class was generated from the following files: