mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-12 05:18:43 +00:00
Fix https://{registry}/me display
This commit is contained in:
@@ -16,9 +16,29 @@ impl Login {
|
||||
fn get_token_or_ask_user(&self) -> Result<String, std::io::Error> {
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user