From 7368b9ff2b98487dac4c847efb0aa8ea62a8f66e Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 20 May 2021 03:23:14 +0000 Subject: feat(cli): conditional logging --- src/cli.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/cli.rs') diff --git a/src/cli.rs b/src/cli.rs index fe43439..259c0e2 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -13,6 +13,11 @@ impl Cli { pub async fn execute() { let matches = Self::cli().get_matches(); + let mut debug = false; + if matches.is_present("debug") { + debug = true; + } + if matches.is_present("generate") { Nitrous::generate( matches @@ -23,6 +28,7 @@ impl Cli { .to_string() .parse::() .unwrap(), + debug, ); } else if matches.is_present("check") { Nitrous::check( @@ -31,6 +37,7 @@ impl Cli { .unwrap() .value_of("file") .unwrap(), + debug, ) .await; } @@ -56,5 +63,12 @@ impl Cli { .index(1), ), ]) + .arg(Arg::with_name("debug") + .long("debug") + .short("d") + .takes_value(false) + .multiple(false) + .global(true) + ) } } -- cgit v1.2.3