auth check clean

This commit is contained in:
dal 2025-05-09 12:49:53 -06:00
parent 69faf4faf9
commit 8d89a23c30
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
2 changed files with 21 additions and 6 deletions

View File

@ -1,7 +1,7 @@
use anyhow::{Result}; use anyhow::{Result};
use async_trait::async_trait; use async_trait::async_trait;
use clap::Parser; use clap::Parser;
use inquire::{Confirm, Password, Text}; use inquire::{Confirm, Password, Text, PasswordDisplayMode};
use thiserror::Error; use thiserror::Error;
use crate::utils::{ use crate::utils::{
@ -274,9 +274,15 @@ async fn prompt_for_missing_credentials(
format!("Enter your API key (current: {obfuscated_api_key}):") format!("Enter your API key (current: {obfuscated_api_key}):")
}; };
let api_key_input = Password::new(&prompt_message) let help_message = format!(
.without_confirmation() "Your API key can be found at {}/app/settings/api-keys. Leave blank to keep the current key.",
.with_help_message("Your API key can be found in your Buster dashboard. Leave blank to keep the current key.") creds.url
);
let api_key_input = Text::new(&prompt_message)
// .without_confirmation() // Removed for Text input
// .with_display_mode(PasswordDisplayMode::Masked) // Removed for Text input
.with_help_message(&help_message)
.prompt() .prompt()
.map_err(|e| AuthError::UserInputFailed(e.to_string()))?; .map_err(|e| AuthError::UserInputFailed(e.to_string()))?;
@ -291,6 +297,8 @@ async fn prompt_for_missing_credentials(
return Err(AuthError::MissingApiKey.into()); return Err(AuthError::MissingApiKey.into());
} }
println!("\n");
Ok(()) Ok(())
} }

View File

@ -96,7 +96,11 @@ pub async fn check_for_updates() {
(Err(e), _) => { (Err(e), _) => {
eprintln!( eprintln!(
"{}", "{}",
format!("Failed to parse current version ({}): {}", CURRENT_VERSION, e).yellow() format!(
"Failed to parse current version ({}): {}",
CURRENT_VERSION, e
)
.yellow()
); );
} }
(_, Err(e)) => { (_, Err(e)) => {
@ -111,4 +115,7 @@ pub async fn check_for_updates() {
); );
} }
} }
println!("\n");
} }