1use std::process::Command;
2
3pub fn truncate(s: &str, max: usize) -> String {
5 crate::core::utils::truncate(s, max)
6}
7
8pub fn open_in_browser(url: &str) -> std::io::Result<std::process::Child> {
14 let mut cmd = if cfg!(target_os = "windows") {
15 let mut c = Command::new("cmd");
16 c.args(["/C", "start", "", url]);
17 c
18 } else if cfg!(target_os = "macos") {
19 Command::new("open")
20 } else {
21 Command::new("xdg-open")
22 };
23
24 if !cfg!(target_os = "windows") {
25 cmd.arg(url);
26 }
27 cmd.spawn()
28}