seamless-glance 1.0.0

Fast, read-only AWS TUI for cloud infrastructure visibility and triage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::process::Command;

pub fn open_in_browser(url: &str) -> Result<(), String> {
    let result = if cfg!(target_os = "macos") {
        Command::new("open").arg(url).spawn()
    } else if cfg!(target_os = "linux") {
        Command::new("xdg-open").arg(url).spawn()
    } else if cfg!(target_os = "windows") {
        Command::new("cmd").args(["/C", "start", url]).spawn()
    } else {
        return Err("Unsupported platform".into());
    };

    result
        .map(|_| ())
        .map_err(|e| format!("Failed to open browser: {}", e))
}