pub struct SimpleCommand<'a, SE: ShellExtensions> {
pub params: ExecutionParameters,
pub command_name: String,
pub args: Vec<CommandArg>,
pub use_functions: bool,
pub path_dirs: Option<Vec<PathBuf>>,
pub process_group_id: Option<i32>,
pub argv0: Option<String>,
pub post_execute: Option<fn(&mut Shell<SE>) -> Result<(), Error>>,
/* private fields */
}Expand description
Represents a simple command to be executed.
Fields§
§params: ExecutionParametersThe execution parameters for the command.
command_name: StringThe name of the command to execute.
args: Vec<CommandArg>The arguments to the command, including the command itself.
use_functions: boolWhether to consider shell functions when looking up the command name. If true, shell functions will be checked; if false, they will be ignored.
path_dirs: Option<Vec<PathBuf>>Optional list of directories to search for external commands. If left
None, the default search logic will be used.
process_group_id: Option<i32>The process group ID to use for externally executed commands. This may be
None, in which case the default behavior will be used.
argv0: Option<String>Optional override for the argv[0] value presented to an externally
spawned process. When None, command_name is used.
post_execute: Option<fn(&mut Shell<SE>) -> Result<(), Error>>Optionally provides a function that can run after execution occurs. Note that it is not invoked if the shell is discarded during the execution process.
Implementations§
Source§impl<'a, SE: ShellExtensions> SimpleCommand<'a, SE>
impl<'a, SE: ShellExtensions> SimpleCommand<'a, SE>
Sourcepub const fn new(
shell: ShellForCommand<'a, SE>,
params: ExecutionParameters,
command_name: String,
args: Vec<CommandArg>,
) -> Self
pub const fn new( shell: ShellForCommand<'a, SE>, params: ExecutionParameters, command_name: String, args: Vec<CommandArg>, ) -> Self
Creates a new SimpleCommand instance.
§Arguments
shell- The shell in which to execute the command.params- The execution parameters for the command.command_name- The name of the command to execute.args- The arguments to the command, including the command itself.
Sourcepub async fn execute(self) -> Result<ExecutionSpawnResult, Error>
pub async fn execute(self) -> Result<ExecutionSpawnResult, Error>
Executes the simple command.
The command may be a builtin, a shell function, or an externally executed command. This function’s implementation is responsible for dispatching it appropriately according to the context provided.
Auto Trait Implementations§
impl<'a, SE> Freeze for SimpleCommand<'a, SE>
impl<'a, SE> !RefUnwindSafe for SimpleCommand<'a, SE>
impl<'a, SE> Send for SimpleCommand<'a, SE>
impl<'a, SE> Sync for SimpleCommand<'a, SE>
impl<'a, SE> Unpin for SimpleCommand<'a, SE>
impl<'a, SE> UnsafeUnpin for SimpleCommand<'a, SE>
impl<'a, SE> !UnwindSafe for SimpleCommand<'a, SE>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more