From daa801c8678ff4af14fe178c5018914270647f7d Mon Sep 17 00:00:00 2001 From: Malted Date: Fri, 21 Jun 2024 04:13:20 -0400 Subject: [PATCH] Open game url in browser when viewed --- cli/src/commands/game.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cli/src/commands/game.rs b/cli/src/commands/game.rs index bf88d8a7..c4cf50e3 100644 --- a/cli/src/commands/game.rs +++ b/cli/src/commands/game.rs @@ -41,7 +41,12 @@ impl SubCommand { Ok(()) } SubCommand::View => { - eprintln!("{}", term::link(dashboard_url(&ctx, &ctx.game_id))); + let url = dashboard_url(&ctx, &ctx.game_id); + eprintln!("Opening {}", term::link(url)); + + if webbrowser::open(&url).is_err() { + eprintln!("Failed to open URL in browser."); + } Ok(()) }