UNPKG

@reliverse/rse-sdk

Version:

@reliverse/rse-sdk without cli. @reliverse/rse-sdk allows you to create new plugins for @reliverse/rse CLI, interact with reliverse.org, and even extend your own CLI functionality (you may also try @reliverse/dler-sdk for this case).

23 lines (22 loc) 567 B
import { relinka } from "@reliverse/relinka"; import { execa } from "execa"; export async function openUrl(url) { const platform = process.platform; let command; let args = []; if (platform === "darwin") { command = "open"; args = [url]; } else if (platform === "win32") { command = "cmd"; args = ["/c", "start", "", url.replace(/&/g, "^&")]; } else { command = "xdg-open"; args = [url]; } try { await execa(command, args, { stdio: "ignore" }); } catch { relinka("info", `Please open ${url} in your browser.`); } }