Skip to content

Commit 530c77e

Browse files
committed
"🚀 Improved API key functionality"
1 parent 442ad45 commit 530c77e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎src/main.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@ async fn main() {
9898
return;
9999
}
100100

101+
let config = &mut utils::get_config();
102+
101103
if args.contains(&"--api-key".to_owned()) {
102-
let config = &mut utils::get_config();
103104
let pos = args.iter().position(|s| s == "--api-key").unwrap();
104105
if pos + 1 >= args.len() {
105106
let api_key = config.get_api_key();
@@ -116,10 +117,12 @@ async fn main() {
116117

117118
println!("{}", "API key set".green());
118119
return;
120+
} else if config.get_api_key().is_empty() {
121+
println!("{}", "No API key set. Set API key first!".yellow());
122+
return;
119123
}
120124

121125
if args.contains(&"--clear-api-key".to_owned()) {
122-
let config = &mut utils::get_config();
123126
config.set_api_key("".to_owned());
124127
config.save();
125128

0 commit comments

Comments
 (0)