feat: more quiet sync

Made quiet argument propagate to
child command in sync subcommand
This commit is contained in:
2026-05-30 01:11:43 +02:00
parent 8c83e733c2
commit 062fb4fce8
2 changed files with 13 additions and 10 deletions
+1 -1
View File
@@ -121,7 +121,7 @@ fn main() -> Result<()> {
x.get_package_list() x.get_package_list()
}; };
update_packages(&not_installed)?; update_packages(&not_installed, args.quiet)?;
if !args.quiet { if !args.quiet {
println!("Succesfully synchronized state with the world file!"); println!("Succesfully synchronized state with the world file!");
+12 -9
View File
@@ -63,31 +63,34 @@ pub fn remove_packages(packages: &[String], all: bool) -> Result<()> {
Ok(()) Ok(())
} }
fn _update_packages(command: Command, packages: &[String]) -> Result<()> { fn _update_packages(command: Command, packages: &[String], quiet: bool) -> Result<()> {
let mut command = command; let mut command = command;
command command
.arg("-Syu") .arg("-Syu")
.args(packages) .args(packages)
.stderr(Stdio::inherit()) .stderr(Stdio::inherit())
.stdout(Stdio::inherit()) .stdout(Stdio::inherit())
.stdin(Stdio::inherit()) .stdin(Stdio::inherit());
.status()?; if quiet {
command.arg("-q");
}
command.status()?;
Ok(()) Ok(())
} }
#[cfg(not(any(feature = "yay", feature = "paru")))] #[cfg(not(any(feature = "yay", feature = "paru")))]
pub fn update_packages(packages: &[String]) -> Result<()> { pub fn update_packages(packages: &[String], quiet: bool) -> Result<()> {
let mut command = Command::new(PRIVLAGE_ESCELATE_COMMAND); let mut command = Command::new(PRIVLAGE_ESCELATE_COMMAND);
command.arg("pacman"); command.arg("pacman");
_update_packages(command, packages) _update_packages(command, packages, quiet)
} }
#[cfg(feature = "yay")] #[cfg(feature = "yay")]
pub fn update_packages(packages: &[String]) -> Result<()> { pub fn update_packages(packages: &[String], quiet: bool) -> Result<()> {
_update_packages(Command::new("yay"), packages) _update_packages(Command::new("yay"), packages, quiet)
} }
#[cfg(feature = "paru")] #[cfg(feature = "paru")]
pub fn update_packages(packages: &[String]) -> Result<()> { pub fn update_packages(packages: &[String], quiet: bool) -> Result<()> {
_update_packages(Command::new("paru"), packages) _update_packages(Command::new("paru"), packages, quiet)
} }