pub fn build_aur_install<S: AsRef<str>>(
helper: AurHelper,
names: &[S],
options: &InstallOptions,
) -> Result<CommandSpec>Expand description
What: Build an AUR helper install command for AUR packages.
Inputs:
helper: The AUR helper to use (from caller config orsuper::detect_aur_helper).names: AUR package names to install (validated).options: Flag options (needed,noconfirm,aur_only).
Output:
Ok(CommandSpec)likeparu -S --aur --needed --noconfirm -- <names...>.
Details:
--aur(whenoptions.aur_only) ensures helpers do not prefer a sync database (e.g., Chaotic-AUR) when the same name exists on the AUR — matching Pacsea’saur_install_helper_flags.- A
--operand terminator separates flags from package names; paru and yay forward it to pacman-style operand parsing. - AUR helpers must NOT run under sudo; they invoke sudo themselves for the
pacman step. Do not wrap the result in
with_privilege.
§Errors
Returns ArchToolkitError::InvalidPackageName when a name fails validation,
or ArchToolkitError::EmptyInput when names is empty.
§Example
use arch_toolkit::install::build_aur_install;
use arch_toolkit::types::install::{AurHelper, InstallOptions};
let spec = build_aur_install(AurHelper::Paru, &["yay-bin"], &InstallOptions::default())?;
assert_eq!(spec.to_shell_string(), "paru -S --aur --needed --noconfirm -- yay-bin");