From 9c96dc9108a0ac05d99654250f1021b5460b4b98 Mon Sep 17 00:00:00 2001 From: Aadi Desai <21363892+supleed2@users.noreply.github.com> Date: Sat, 22 Apr 2023 18:49:03 +0100 Subject: [PATCH] Print API key only when verbose flag given --- src/main.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index fee3dc3..b097455 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,7 +39,9 @@ fn main() -> anyhow::Result<()> { .expect("omg.lol username not provided as command line option, environment variable or in config file"); println!("omg-rs, ready for @{name}"); - println!("API key: {}", api_key); + if cli.verbose > 0 { + println!("API key: {}", api_key); + } Ok(()) } @@ -53,10 +55,7 @@ fn save_api_key(api_key: &str) -> std::io::Result<()> { .parent() .expect("Unable to get parent dir of config.toml"), ); - let Config { - api_key: _, - name, - } = read_to_string(&config_path) + let Config { api_key: _, name } = read_to_string(&config_path) .ok() .and_then(|str| toml::from_str::(&str).ok()) .unwrap_or_default();