( os: NodeJS.Platform, wayland: boolean, has: (name: string) => boolean, )
| 74 | } |
| 75 | |
| 76 | export function copyCommand( |
| 77 | os: NodeJS.Platform, |
| 78 | wayland: boolean, |
| 79 | has: (name: string) => boolean, |
| 80 | ): string[] | undefined { |
| 81 | if (os === "darwin" && has("osascript")) return ["osascript"] |
| 82 | if (os === "linux" && wayland && has("wl-copy")) return ["wl-copy"] |
| 83 | if (os === "linux" && has("xclip")) return ["xclip", "-selection", "clipboard"] |
| 84 | if (os === "linux" && has("xsel")) return ["xsel", "--clipboard", "--input"] |
| 85 | if (os === "win32" && has("powershell.exe")) { |
| 86 | return [ |
| 87 | "powershell.exe", |
| 88 | "-NonInteractive", |
| 89 | "-NoProfile", |
| 90 | "-Command", |
| 91 | "[Console]::InputEncoding = [System.Text.Encoding]::UTF8; Set-Clipboard -Value ([Console]::In.ReadToEnd())", |
| 92 | ] |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | let copyMethod: Promise<(text: string) => Promise<void>> | undefined |
| 97 |
no test coverage detected