MCPcopy Create free account
hub / github.com/anomalyco/opencode / copyCommand

Function copyCommand

packages/tui/src/clipboard.ts:76–94  ·  view source on GitHub ↗
(
  os: NodeJS.Platform,
  wayland: boolean,
  has: (name: string) => boolean,
)

Source from the content-addressed store, hash-verified

74}
75
76export 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
96let copyMethod: Promise<(text: string) => Promise<void>> | undefined
97

Callers 2

clipboard.test.tsFile · 0.90
getCopyMethodFunction · 0.85

Calls 1

hasFunction · 0.50

Tested by

no test coverage detected