Download packages/tui/test/clipboard.test.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 798 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/tui/test/clipboard.test.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/tui/test/clipboard.test.ts
-
curl -L -o clipboard.test.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/tui/test/clipboard.test.ts
798 Bytes
| import { expect, test } from "bun:test" | |
| import { copyCommand } from "../src/clipboard" | |
| test("prefers Wayland clipboard when available", () => { | |
| expect(copyCommand("linux", true, (name) => name === "wl-copy")).toEqual(["wl-copy"]) | |
| }) | |
| test("uses osascript on macOS", () => { | |
| expect(copyCommand("darwin", false, (name) => name === "osascript")).toEqual(["osascript"]) | |
| }) | |
| test("falls back through X11 clipboard commands", () => { | |
| expect(copyCommand("linux", true, (name) => name === "xclip")).toEqual(["xclip", "-selection", "clipboard"]) | |
| expect(copyCommand("linux", false, (name) => name === "xsel")).toEqual(["xsel", "--clipboard", "--input"]) | |
| }) | |
| test("returns undefined when native clipboard is unavailable", () => { | |
| expect(copyCommand("linux", false, () => false)).toBeUndefined() | |
| }) | |