pub struct ShellCommand {
pub args: Vec<String>,
pub redirections: Vec<Redirection>,
pub compound: Option<Box<Ast>>,
}Expand description
Represents a single command in a pipeline.
A shell command consists of:
- Arguments (command name and parameters)
- Redirections (I/O redirection operations)
- Optional compound command (for subshells, groups, etc.)
If compound is present, it takes precedence over args during execution.
Fields§
§args: Vec<String>Command arguments (first element is the command name).
For simple commands like ls -la, this would be ["ls", "-la"].
redirections: Vec<Redirection>All redirections in order of appearance.
Redirections are processed left-to-right per POSIX specification.
For example, in cmd >file1 2>&1 >file2, the redirections are:
- Redirect stdout to file1
- Duplicate stderr to stdout (which points to file1)
- Redirect stdout to file2 (stderr still points to file1)
compound: Option<Box<Ast>>Optional compound command (subshell, command group, etc.).
If present, this takes precedence over args during execution.
Used for constructs like (subshell) | cmd or { group; } | cmd.
Trait Implementations§
Source§impl Clone for ShellCommand
impl Clone for ShellCommand
Source§fn clone(&self) -> ShellCommand
fn clone(&self) -> ShellCommand
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ShellCommand
impl Debug for ShellCommand
Source§impl Default for ShellCommand
impl Default for ShellCommand
Source§fn default() -> ShellCommand
fn default() -> ShellCommand
Returns the “default value” for a type. Read more
Source§impl PartialEq for ShellCommand
impl PartialEq for ShellCommand
impl Eq for ShellCommand
impl StructuralPartialEq for ShellCommand
Auto Trait Implementations§
impl Freeze for ShellCommand
impl RefUnwindSafe for ShellCommand
impl Send for ShellCommand
impl Sync for ShellCommand
impl Unpin for ShellCommand
impl UnwindSafe for ShellCommand
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more