feat: sync subcommand

This commit is contained in:
2026-05-30 00:41:44 +02:00
parent 5a614e366e
commit 027efa3f83
2 changed files with 48 additions and 2 deletions
+29
View File
@@ -62,3 +62,32 @@ pub fn remove_packages(packages: &[String], all: bool) -> Result<()> {
Ok(())
}
fn _update_packages(command: Command, packages: &[String]) -> Result<()> {
let mut command = command;
command
.arg("-Syu")
.args(packages)
.stderr(Stdio::inherit())
.stdout(Stdio::inherit())
.stdin(Stdio::inherit())
.status()?;
Ok(())
}
#[cfg(not(any(feature = "yay", feature = "paru")))]
pub fn update_packages(packages: &[String]) -> Result<()> {
let mut command = Command::new(PRIVLAGE_ESCELATE_COMMAND);
command.arg("pacman");
_update_packages(command, packages)
}
#[cfg(feature = "yay")]
pub fn update_packages(packages: &[String]) -> Result<()> {
_update_packages(Command::new("yay"), packages)
}
#[cfg(feature = "paru")]
pub fn update_packages(packages: &[String]) -> Result<()> {
_update_packages(Command::new("paru"), packages)
}