From 618d2206a2c40d1ddf5bea4c1cfa8f5894560c2f Mon Sep 17 00:00:00 2001 From: bytedream Date: Sat, 24 Jun 2023 13:05:30 +0200 Subject: [PATCH] Hide interactive output when -q flag is set --- crunchy-cli-core/src/lib.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/crunchy-cli-core/src/lib.rs b/crunchy-cli-core/src/lib.rs index 5aef69a..982aa17 100644 --- a/crunchy-cli-core/src/lib.rs +++ b/crunchy-cli-core/src/lib.rs @@ -120,8 +120,20 @@ pub async fn cli_entrypoint() { debug!("cli input: {:?}", cli); match &mut cli.command { - Command::Archive(archive) => pre_check_executor(archive).await, - Command::Download(download) => pre_check_executor(download).await, + Command::Archive(archive) => { + // prevent interactive select to be shown when output should be quiet + if cli.verbosity.is_some() && cli.verbosity.as_ref().unwrap().quiet { + archive.yes = true; + } + pre_check_executor(archive).await + } + Command::Download(download) => { + // prevent interactive select to be shown when output should be quiet + if cli.verbosity.is_some() && cli.verbosity.as_ref().unwrap().quiet { + download.yes = true; + } + pre_check_executor(download).await + } Command::Login(login) => { if login.remove { if let Some(session_file) = login::session_file_path() {