From 2dfd0a6972478b257a134aa1dbf1a1c05985d608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BChlbacher?= Date: Thu, 27 Jun 2024 13:53:41 +0200 Subject: [PATCH] feat: add `--quiet` cli argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To silence log outputs on the CLI. Signed-off-by: Thomas Mühlbacher --- src/commands/list.rs | 6 +++++- src/commands/mount.rs | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/commands/list.rs b/src/commands/list.rs index 360939092..b7a42916f 100644 --- a/src/commands/list.rs +++ b/src/commands/list.rs @@ -152,6 +152,10 @@ pub struct Cli { #[arg(short, long, action = clap::ArgAction::Set, default_value_t=stdout().is_terminal())] colorize: bool, + /// Quiet mode + #[arg(short, long)] + quiet: bool, + /// Verbose mode #[arg(short, long, action = clap::ArgAction::Count)] verbose: u8, @@ -201,7 +205,7 @@ pub fn list(argv: Vec) -> i32 { let opt = Cli::parse_from(argv); // TODO: centralize this on the top level CLI - logging::setup(false, opt.verbose, opt.colorize); + logging::setup(opt.quiet, opt.verbose, opt.colorize); if let Err(e) = cmd_list_inner(&opt) { error!("Fatal error: {}", e); diff --git a/src/commands/mount.rs b/src/commands/mount.rs index da3c03390..05c8979d0 100644 --- a/src/commands/mount.rs +++ b/src/commands/mount.rs @@ -258,6 +258,10 @@ pub struct Cli { #[arg(short, long, action = clap::ArgAction::Set, default_value_t=stdout().is_terminal())] colorize: bool, + /// Quiet mode + #[arg(short, long)] + quiet: bool, + /// Verbose mode #[arg(short, long, action = clap::ArgAction::Count)] verbose: u8, @@ -388,7 +392,7 @@ pub fn mount(mut argv: Vec, symlink_cmd: Option<&str>) -> i32 { let opt = Cli::parse_from(argv); // TODO: centralize this on the top level CLI - logging::setup(false, opt.verbose, opt.colorize); + logging::setup(opt.quiet, opt.verbose, opt.colorize); if let Err(e) = cmd_mount_inner(opt) { error!("Fatal error: {}", e);