summaryrefslogtreecommitdiff
path: root/cli/tools/registry/mod.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-01-31 22:38:57 +0100
committerGitHub <noreply@github.com>2024-01-31 22:38:57 +0100
commit163491f2378febc846190f64b60f199bd8e5ede8 (patch)
tree9d7edfe713d1ec554211978fa0e439ecbc20ef37 /cli/tools/registry/mod.rs
parentb91ae888601f3c6602ceb9ec083ac252d06e64ce (diff)
chore(publish): try to automatically open the web browser (#22208)
Diffstat (limited to 'cli/tools/registry/mod.rs')
-rw-r--r--cli/tools/registry/mod.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/cli/tools/registry/mod.rs b/cli/tools/registry/mod.rs
index 574166348..cc2488a10 100644
--- a/cli/tools/registry/mod.rs
+++ b/cli/tools/registry/mod.rs
@@ -208,9 +208,10 @@ async fn get_auth_headers(
.await
.context("Failed to create interactive authorization")?;
+ let auth_url = format!("{}?code={}", auth.verification_url, auth.code);
print!(
"Visit {} to authorize publishing of",
- colors::cyan(format!("{}?code={}", auth.verification_url, auth.code))
+ colors::cyan(&auth_url)
);
if packages.len() > 1 {
println!(" {} packages", packages.len());
@@ -220,6 +221,7 @@ async fn get_auth_headers(
ring_bell();
println!("{}", colors::gray("Waiting..."));
+ let _ = webbrowser::open(&auth_url);
let interval = std::time::Duration::from_secs(auth.poll_interval);
@@ -410,9 +412,10 @@ async fn ensure_scopes_and_packages_exist(
"'@{}/{}' doesn't exist yet. Visit {} to create the package",
&package.scope,
&package.package,
- colors::cyan_with_underline(create_package_url)
+ colors::cyan_with_underline(&create_package_url)
);
println!("{}", colors::gray("Waiting..."));
+ let _ = webbrowser::open(&create_package_url);
let package_api_url = api::get_package_api_url(
&registry_api_url,