From cfd8cc19b6a81ad78bc30d5b21cefe21d574d09e Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 13 Feb 2026 08:12:05 +0000 Subject: feat: add --verbose/-v flag for detailed output Adds a global --verbose/-v flag that sets NGIT_VERBOSE environment variable. Also sets NGIT_VERBOSE automatically when NGIT_TEST is set. --- src/bin/ngit/cli.rs | 3 +++ src/bin/ngit/main.rs | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/src/bin/ngit/cli.rs b/src/bin/ngit/cli.rs index dd7196c..c77e719 100644 --- a/src/bin/ngit/cli.rs +++ b/src/bin/ngit/cli.rs @@ -42,6 +42,9 @@ pub struct Cli { /// Force operations, bypass safety guards #[arg(short = 'f', long, global = true)] pub force: bool, + /// Enable verbose output + #[arg(short = 'v', long, global = true)] + pub verbose: bool, } pub const CUSTOMISE_TEMPLATE: &str = r" diff --git a/src/bin/ngit/main.rs b/src/bin/ngit/main.rs index f405e94..65f6bca 100644 --- a/src/bin/ngit/main.rs +++ b/src/bin/ngit/main.rs @@ -15,6 +15,10 @@ use ngit::{ mod sub_commands; +fn is_verbose() -> bool { + std::env::var("NGIT_VERBOSE").is_ok() || std::env::var("NGIT_TEST").is_ok() +} + #[tokio::main] async fn main() { let cli = Cli::parse(); @@ -25,6 +29,10 @@ async fn main() { std::env::set_var("NGIT_INTERACTIVE_MODE", "1"); } + if cli.verbose || std::env::var("NGIT_TEST").is_ok() { + std::env::set_var("NGIT_VERBOSE", "1"); + } + if cli.customize { print!("{CUSTOMISE_TEMPLATE}"); std::process::exit(0); // Exit the program -- cgit v1.2.3