pub struct CommandSpec {
pub program: String,
pub args: Vec<String>,
}Expand description
What: A ready-to-run command as program plus argument vector.
Inputs:
- Produced by the
installmodule command builders.
Output:
- Can be spawned directly (
to_command()) or rendered for display (to_shell_string()).
Details:
- Argv-style representation avoids shell interpretation entirely when spawned directly, eliminating quoting bugs.
- arch-toolkit never executes commands itself; callers decide whether to run, display (dry run), or embed the command.
Fields§
§program: StringThe program to execute (e.g., pacman, paru, sudo).
args: Vec<String>Arguments passed to the program, unquoted (argv semantics).
Implementations§
Source§impl CommandSpec
impl CommandSpec
Sourcepub fn new(
program: impl Into<String>,
args: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn new( program: impl Into<String>, args: impl IntoIterator<Item = impl Into<String>>, ) -> Self
What: Create a new command spec from a program and arguments.
Inputs:
program: Program name or path.args: Argument list (unquoted).
Output: CommandSpec instance.
Details: Convenience constructor accepting anything convertible to String.
Sourcepub fn to_shell_string(&self) -> String
pub fn to_shell_string(&self) -> String
What: Render this command as a properly quoted POSIX shell string.
Inputs: None.
Output: Shell-safe string like sudo pacman -S --needed --noconfirm 'ripgrep'.
Details:
- Arguments containing anything outside
[A-Za-z0-9@%^_+=:,./-]are single-quoted with embedded quotes escaped. - Intended for display (dry runs) and for passing to
bash -cin terminal-spawning callers.
Sourcepub fn to_command(&self) -> Command
pub fn to_command(&self) -> Command
What: Convert this spec into a std::process::Command ready to spawn.
Inputs: None.
Output: Configured std::process::Command (not yet spawned).
Details:
- No shell is involved; arguments are passed verbatim to the OS.
- Callers remain responsible for spawning and privilege context.
Trait Implementations§
Source§impl Clone for CommandSpec
impl Clone for CommandSpec
Source§fn clone(&self) -> CommandSpec
fn clone(&self) -> CommandSpec
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 CommandSpec
impl Debug for CommandSpec
Source§impl<'de> Deserialize<'de> for CommandSpec
impl<'de> Deserialize<'de> for CommandSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for CommandSpec
impl Display for CommandSpec
impl Eq for CommandSpec
Source§impl PartialEq for CommandSpec
impl PartialEq for CommandSpec
Source§impl Serialize for CommandSpec
impl Serialize for CommandSpec
impl StructuralPartialEq for CommandSpec
Auto Trait Implementations§
impl Freeze for CommandSpec
impl RefUnwindSafe for CommandSpec
impl Send for CommandSpec
impl Sync for CommandSpec
impl Unpin for CommandSpec
impl UnsafeUnpin for CommandSpec
impl UnwindSafe for CommandSpec
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.