Skip to content

Commit

Permalink
✨ Add support verbosity option to command line argument
Browse files Browse the repository at this point in the history
  • Loading branch information
ChanTsune committed Aug 13, 2024
1 parent 71a6241 commit 929175b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
6 changes: 4 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit 929175b

Please sign in to comment.