refactor(tui): organize source by feature boundaries (#5975)
* refactor(tui): group source files by feature * refactor(tui): split app and gateway responsibilities
This commit is contained in:
1 parent
b7abbcd70b
commit
f18423800e
73 files changed
+6401
-6006
No files matched your search
@@ -0,0 +1,18 @@
|
||||
export async function copyWithSystemClipboard(text: string): Promise<void> {
|
||||
const commands = process.platform === "darwin"
|
||||
? [["pbcopy"]]
|
||||
: process.platform === "win32"
|
||||
? [["clip.exe"]]
|
||||
: [["wl-copy"], ["xclip", "-selection", "clipboard"], ["xsel", "--clipboard", "--input"]]
|
||||
for (const command of commands) {
|
||||
try {
|
||||
const child = Bun.spawn(command, { stdin: "pipe", stdout: "ignore", stderr: "ignore" })
|
||||
child.stdin.write(text)
|
||||
child.stdin.end()
|
||||
if (await child.exited === 0) return
|
||||
} catch {
|
||||
// Try the next platform clipboard provider.
|
||||
}
|
||||
}
|
||||
throw new Error("no clipboard provider available")
|
||||
}
|
||||
Reference in new issue
Block a user