From 5d14b50531a7172fcb22b947eb9f428e4da0e664 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Sun, 16 Jul 2023 09:16:18 -0400 Subject: [PATCH] Make verbose work more like expected --- src/main.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index be22d03..dc7e35d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,8 +35,8 @@ struct Config { output_dir: Option, #[arg(required = true)] date: String, - #[arg(short, long)] - verbose: bool, + #[arg(short, long, action = clap::ArgAction::Count)] + verbose: u8, } #[tokio::main] @@ -49,7 +49,11 @@ async fn main() -> Result<()> { output_dir, } = Config::parse(); - let level = if verbose { "debug" } else { "off" }; + let level = match verbose { + 0 => "off", + 1 => "debug", + _ => "trace", + }; env::set_var("RUST_LOG", format!("{}={}", module_path!(), level)); env_logger::init();