Skip to content

Commit d5fae3d

Browse files
committed
feat: automatically open the auth URL
Initially discussed the opposite with @adriencaccia but this is better
1 parent 2d68f54 commit d5fae3d

3 files changed

Lines changed: 44 additions & 1 deletion

File tree

Cargo.lock

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ runner-shared = { path = "crates/runner-shared" }
5959
shellexpand = { version = "3.1.1", features = ["tilde"] }
6060
addr2line = "0.25"
6161
gimli = "0.32"
62+
open = "5.3.2"
6263

6364
[target.'cfg(target_os = "linux")'.dependencies]
6465
procfs = "0.17.0"

src/auth.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@ async fn login(api_client: &CodSpeedAPIClient) -> Result<()> {
3232
let login_session_payload = api_client.create_login_session().await?;
3333
end_group!();
3434

35+
if open::that(&login_session_payload.callback_url).is_ok() {
36+
info!("Your browser has been opened to complete the login process");
37+
} else {
38+
warn!("Failed to open the browser automatically, please open the URL manually");
39+
}
3540
info!(
36-
"Login session created, open the following URL in your browser: {}\n",
41+
"Authentication URL: {}\n",
3742
style(login_session_payload.callback_url)
3843
.blue()
3944
.bold()

0 commit comments

Comments
 (0)