pub fn open_url(url: &str)Expand description
What: Open a URL in the default browser (cross-platform).
Inputs:
url: URL string to open.
Output:
- No return value; spawns a background process to open the URL.
Details:
- On Windows, uses
cmd /c start, with fallback toPowerShellStart-Process. - On Unix-like systems (Linux/macOS), uses
xdg-open(Linux) oropen(macOS). - Spawns the command in a background thread and ignores errors.
- During tests, this is a no-op to avoid opening real browser windows.
ยงExamples
use pacsea::util::open_url;
// Opening the AUR page of a package for manual review
open_url("https://aur.archlinux.org/packages/linux-zen");
// Opening the Arch Linux package search in a browser
open_url("https://archlinux.org/packages/?q=neovim");
// Opening the Pacsea project's GitHub page for issue reporting
open_url("https://github.com/Firstp1ck/Pacsea");
// Note: This function runs asynchronously and does not block.
// During tests (`cargo test`), it's a no-op to prevent opening browsers.