Skip to content

Commit 8870b0a

Browse files
committed
feat: automatically open the auth URL
Initially discussed the opposite with @adriencaccia but this is better
1 parent b9a0aa2 commit 8870b0a

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
@@ -57,6 +57,7 @@ nix = { version = "0.29.0", features = ["fs", "time", "user"] }
5757
futures = "0.3.31"
5858
runner-shared = { path = "crates/runner-shared" }
5959
shellexpand = { version = "3.1.1", features = ["tilde"] }
60+
open = "5.3.2"
6061

6162
[target.'cfg(target_os = "linux")'.dependencies]
6263
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)