diff --git a/lib/cli/src/commands/login.rs b/lib/cli/src/commands/login.rs index 796b2231c..290c1e73f 100644 --- a/lib/cli/src/commands/login.rs +++ b/lib/cli/src/commands/login.rs @@ -16,9 +16,29 @@ impl Login { fn get_token_or_ask_user(&self) -> Result { match self.token.as_ref() { Some(s) => Ok(s.clone()), - None => Input::new() - .with_prompt("Please paste the login token from https://wapm.io/me:\"") - .interact_text(), + None => { + let registry_host = url::Url::parse(&wasmer_registry::format_graphql( + &self.registry, + )) + .map_err(|e| { + std::io::Error::new( + std::io::ErrorKind::Other, + format!("Invalid registry for login {}: {e}", self.registry), + ) + })?; + let registry_host = registry_host.host_str().ok_or_else(|| { + std::io::Error::new( + std::io::ErrorKind::Other, + format!("Invalid registry for login {}: no host", self.registry), + ) + })?; + Input::new() + .with_prompt(&format!( + "Please paste the login token from https://{}/me:\"", + registry_host + )) + .interact_text() + } } } diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 860f32f3d..db725ebe4 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -8,7 +8,8 @@ pub mod graphql; pub mod login; pub mod utils; -use crate::config::{format_graphql, Registries}; +pub use crate::config::format_graphql; +use crate::config::Registries; pub use config::PartialWapmConfig; pub static GLOBAL_CONFIG_FILE_NAME: &str = if cfg!(target_os = "wasi") {