operations/upgrade: support quiet option

i18n
Fries 2 years ago committed by Michal
parent 8be997002e
commit 16e9cbc937

@ -268,6 +268,7 @@ impl PacmanSearchBuilder {
#[derive(Default, Debug, Clone)]
pub struct PacmanUpgradeBuilder {
no_confirm: bool,
quiet: bool,
}
impl PacmanUpgradeBuilder {
@ -277,6 +278,12 @@ impl PacmanUpgradeBuilder {
self
}
pub fn quiet(mut self, quiet: bool) -> Self {
self.quiet = quiet;
self
}
#[tracing::instrument(level = "trace")]
pub async fn upgrade(self) -> AppResult<()> {
let mut command = ShellCommand::pacman().elevated().arg("-Syu");
@ -285,6 +292,10 @@ impl PacmanUpgradeBuilder {
command = command.arg("--noconfirm")
}
if self.quiet {
command = command.arg("--quiet")
}
command.wait_success().await
}
}

@ -25,11 +25,13 @@ pub async fn upgrade(args: UpgradeArgs, options: Options) {
#[tracing::instrument(level = "trace")]
async fn upgrade_repo(options: Options) {
let noconfirm = options.noconfirm;
let quiet = options.quiet;
tracing::debug!("Upgrading repo packages");
let result = PacmanUpgradeBuilder::default()
.no_confirm(noconfirm)
.quiet(quiet)
.upgrade()
.await;

Loading…
Cancel
Save