mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 12:22:14 +03:00
- spinner.mjs: withSpinner/shouldUseSpinner com suporte a quiet/output/CI/NO_COLOR - open.mjs: comando `open` com 16 recursos, respeita ambientes restritos - environment.mjs: detectRestrictedEnvironment/getEnvBanner (codespaces/wsl/gitpod/replit/ci) - clipboard.mjs: copyToClipboard/isClipboardSupported (pbcopy/clip/xclip/xsel/wl-copy) - check-env-doc-sync: vars de plataforma/OS adicionadas ao IGNORE_FROM_CODE
36 lines
917 B
JavaScript
36 lines
917 B
JavaScript
import { execSync } from "node:child_process";
|
|
|
|
export function copyToClipboard(text) {
|
|
try {
|
|
const execOpts = { input: text, stdio: ["pipe", "ignore", "ignore"], timeout: 2000 };
|
|
if (process.platform === "darwin") {
|
|
execSync("pbcopy", execOpts);
|
|
} else if (process.platform === "win32") {
|
|
execSync("clip", execOpts);
|
|
} else {
|
|
try {
|
|
execSync("xclip -selection clipboard", execOpts);
|
|
} catch {
|
|
try {
|
|
execSync("xsel --clipboard --input", execOpts);
|
|
} catch {
|
|
execSync("wl-copy", execOpts);
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
export function isClipboardSupported() {
|
|
if (process.platform === "darwin" || process.platform === "win32") return true;
|
|
try {
|
|
execSync("which xclip || which xsel || which wl-copy", { stdio: "ignore" });
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|