diff --git a/src/cli.rs b/src/cli.rs index 3937fe7..9563e3b 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -12,6 +12,8 @@ use clap::{Parser, Subcommand}; pub(crate) struct Cli { #[clap(subcommand)] pub(crate) subcommand: SubCommand, + #[command(flatten)] + pub(crate) verbose: clap_verbosity_flag::Verbosity, } #[derive(Subcommand)] diff --git a/src/main.rs b/src/main.rs index 9c2ac47..e4ca37d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,9 @@ mod file_manager; mod filesystem; fn main() -> io::Result<()> { + let args = cli::Cli::parse(); #[cfg(feature = "logging")] - simple_logger::init_with_level(log::Level::Trace).map_err(io::Error::other)?; - command::entry(cli::Cli::parse()) + simple_logger::init_with_level(args.verbose.log_level().unwrap_or(log::Level::Trace)) + .map_err(io::Error::other)?; + command::entry(args) }