pub fn check_for_api_key() -> String {
    if let Some(api_key) = get_api_key_from_file(){
        return api_key;
    }
    else {
        println!("You do not have your node api key saved for use with this CLI app.\nPlease enter it now:");
        let mut input = String::new();
        if let Ok(_) = std::io::stdin().read_line(&mut input){
            println!("API key inputted: {}", input);
            input.retain(|c| c != '\n' && c != ' ');
            save_api_key_to_file(&input.trim().to_string());
        }
        else {
            panic!("Provided invalid input. Please relaunch the CLI app and try again with a valid API key.")
        }
        return input;
    }
}
/// Tries to get api key from `api.key` file, else asks the user to enter their api key and saves it to `api.key`
Tries to get api key from `api.key` file, else asks the user to enter their api key and saves it to `api.key`
Tries to get api key from ` api . key ` file else asks the user to enter their api key and saves it to ` api . key `
pub fn check_for_api_key() -> String {
    if let Some(api_key) = get_api_key_from_file(){
        return api_key;
    }
    else {
        println!("You do not have your node api key saved for use with this CLI app.\nPlease enter it now:");
        let mut input = String::new();
        if let Ok(_) = std::io::stdin().read_line(&mut input){
            println!("API key inputted: {}", input);
            input.retain(|c| c != '\n' && c != ' ');
            save_api_key_to_file(&input.trim().to_string());
        }
        else {
            panic!("Provided invalid input. Please relaunch the CLI app and try again with a valid API key.")
        }
        return input;
    }
}
pub fn check_for_api_key ( ) -> String { if let Some ( api_key ) = get_api_key_from_file ( ) { return api_key ; } else { println ! ( " \n " ) ; let mut input = String :: new ( ) ; if let Ok ( _ ) = std :: io :: stdin ( ) . read_line ( & mut input ) { println ! ( " " input ) ; input . retain ( | c | c != '\n' && c != ' ' ) ; save_api_key_to_file ( & input . trim ( ) . to_string ( ) ) ; } else { panic ! ( " " ) } return input ; } }
Tries to get api key from `api.key` file, else asks the user to enter their api key and saves it to `api.key`
Tries to get api key from ` api . key ` file else asks the user to enter their api key and saves it to ` api . key `