pub struct Command {
pub name: String,
pub arguments: Vec<String>,
pub flags: Vec<String>,
}Expand description
A single command extracted from a shell script.
Fields§
§name: StringCommand name (e.g., “apt-get”, “pip”).
arguments: Vec<String>All arguments including flags.
flags: Vec<String>Extracted flags (e.g., [“-y”, “–no-cache”]).
Implementations§
Source§impl Command
impl Command
Sourcepub fn has_args(&self, expected_name: &str, expected_args: &[&str]) -> bool
pub fn has_args(&self, expected_name: &str, expected_args: &[&str]) -> bool
Check if the command has specific arguments.
Sourcepub fn has_any_arg(&self, args: &[&str]) -> bool
pub fn has_any_arg(&self, args: &[&str]) -> bool
Check if the command has any of the specified arguments.
Sourcepub fn has_any_flag(&self, flags: &[&str]) -> bool
pub fn has_any_flag(&self, flags: &[&str]) -> bool
Check if the command has any of the specified flags.
Sourcepub fn args_no_flags(&self) -> Vec<&str>
pub fn args_no_flags(&self) -> Vec<&str>
Get arguments without flags.
Sourcepub fn get_flag_value(&self, flag: &str) -> Option<&str>
pub fn get_flag_value(&self, flag: &str) -> Option<&str>
Get the value for a flag (e.g., “-t” returns “release” for “-t=release”).
Sourcepub fn is_pip_install(&self) -> bool
pub fn is_pip_install(&self) -> bool
Check if this is a pip install command.
Sourcepub fn is_apt_get_install(&self) -> bool
pub fn is_apt_get_install(&self) -> bool
Check if this is an apt-get install command.
Sourcepub fn is_apk_add(&self) -> bool
pub fn is_apk_add(&self) -> bool
Check if this is an apk add command.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Command
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnwindSafe for Command
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.