File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -98,8 +98,9 @@ async fn main() {
98
98
return ;
99
99
}
100
100
101
+ let config = & mut utils:: get_config ( ) ;
102
+
101
103
if args. contains ( & "--api-key" . to_owned ( ) ) {
102
- let config = & mut utils:: get_config ( ) ;
103
104
let pos = args. iter ( ) . position ( |s| s == "--api-key" ) . unwrap ( ) ;
104
105
if pos + 1 >= args. len ( ) {
105
106
let api_key = config. get_api_key ( ) ;
@@ -116,10 +117,12 @@ async fn main() {
116
117
117
118
println ! ( "{}" , "API key set" . green( ) ) ;
118
119
return ;
120
+ } else if config. get_api_key ( ) . is_empty ( ) {
121
+ println ! ( "{}" , "No API key set. Set API key first!" . yellow( ) ) ;
122
+ return ;
119
123
}
120
124
121
125
if args. contains ( & "--clear-api-key" . to_owned ( ) ) {
122
- let config = & mut utils:: get_config ( ) ;
123
126
config. set_api_key ( "" . to_owned ( ) ) ;
124
127
config. save ( ) ;
125
128
You can’t perform that action at this time.
0 commit comments