mirror of
https://github.com/supleed2/omg-rs.git
synced 2024-12-22 13:45:51 +00:00
Print API key only when verbose flag given
This commit is contained in:
parent
4d2f326837
commit
9c96dc9108
|
@ -39,7 +39,9 @@ fn main() -> anyhow::Result<()> {
|
||||||
.expect("omg.lol username not provided as command line option, environment variable or in config file");
|
.expect("omg.lol username not provided as command line option, environment variable or in config file");
|
||||||
|
|
||||||
println!("omg-rs, ready for @{name}");
|
println!("omg-rs, ready for @{name}");
|
||||||
println!("API key: {}", api_key);
|
if cli.verbose > 0 {
|
||||||
|
println!("API key: {}", api_key);
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,10 +55,7 @@ fn save_api_key(api_key: &str) -> std::io::Result<()> {
|
||||||
.parent()
|
.parent()
|
||||||
.expect("Unable to get parent dir of config.toml"),
|
.expect("Unable to get parent dir of config.toml"),
|
||||||
);
|
);
|
||||||
let Config {
|
let Config { api_key: _, name } = read_to_string(&config_path)
|
||||||
api_key: _,
|
|
||||||
name,
|
|
||||||
} = read_to_string(&config_path)
|
|
||||||
.ok()
|
.ok()
|
||||||
.and_then(|str| toml::from_str::<Config>(&str).ok())
|
.and_then(|str| toml::from_str::<Config>(&str).ok())
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
Loading…
Reference in a new issue