diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-13 08:12:05 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-13 08:12:05 +0000 |
| commit | cfd8cc19b6a81ad78bc30d5b21cefe21d574d09e (patch) | |
| tree | 1c87060ebc36da51e17bbb3ac246e77035ee362c /src/bin/ngit/main.rs | |
| parent | 64f1cf4f8e021f52f8e7df75e62f10d32d9fa101 (diff) | |
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.
Diffstat (limited to 'src/bin/ngit/main.rs')
| -rw-r--r-- | src/bin/ngit/main.rs | 8 |
1 files changed, 8 insertions, 0 deletions
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::{ | |||
| 15 | 15 | ||
| 16 | mod sub_commands; | 16 | mod sub_commands; |
| 17 | 17 | ||
| 18 | fn is_verbose() -> bool { | ||
| 19 | std::env::var("NGIT_VERBOSE").is_ok() || std::env::var("NGIT_TEST").is_ok() | ||
| 20 | } | ||
| 21 | |||
| 18 | #[tokio::main] | 22 | #[tokio::main] |
| 19 | async fn main() { | 23 | async fn main() { |
| 20 | let cli = Cli::parse(); | 24 | let cli = Cli::parse(); |
| @@ -25,6 +29,10 @@ async fn main() { | |||
| 25 | std::env::set_var("NGIT_INTERACTIVE_MODE", "1"); | 29 | std::env::set_var("NGIT_INTERACTIVE_MODE", "1"); |
| 26 | } | 30 | } |
| 27 | 31 | ||
| 32 | if cli.verbose || std::env::var("NGIT_TEST").is_ok() { | ||
| 33 | std::env::set_var("NGIT_VERBOSE", "1"); | ||
| 34 | } | ||
| 35 | |||
| 28 | if cli.customize { | 36 | if cli.customize { |
| 29 | print!("{CUSTOMISE_TEMPLATE}"); | 37 | print!("{CUSTOMISE_TEMPLATE}"); |
| 30 | std::process::exit(0); // Exit the program | 38 | std::process::exit(0); // Exit the program |