pub fn build_remove_command<S: AsRef<str>>(
names: &[S],
cascade: CascadeMode,
noconfirm: bool,
) -> Result<CommandSpec>Expand description
What: Build a pacman remove command with the requested cascade level.
Inputs:
names: Package names to remove (validated).cascade: Cascade level (-R,-Rs, or-Rns).noconfirm: Pass--noconfirmfor non-interactive removal.
Output:
Ok(CommandSpec)likepacman -Rns --noconfirm -- <names...>.
Details:
- Does NOT prefix a privilege tool; use
with_privilegefor that. - Cascade semantics ported from Pacsea’s
CascadeMode. - A
--operand terminator separates flags from package names.
§Errors
Returns ArchToolkitError::InvalidPackageName when a name fails validation,
or ArchToolkitError::EmptyInput when names is empty.
§Example
use arch_toolkit::install::build_remove_command;
use arch_toolkit::types::install::CascadeMode;
let spec = build_remove_command(&["ripgrep"], CascadeMode::CascadeWithConfigs, true)?;
assert_eq!(spec.to_shell_string(), "pacman -Rns --noconfirm -- ripgrep");