MCPcopy Index your code
hub / github.com/anomalyco/opencode / fill

Function fill

packages/opencode/test/tool/shell.test.ts:116–124  ·  view source on GitHub ↗
(mode: "lines" | "bytes", n: number)

Source from the content-addressed store, hash-verified

114const evalarg = (text: string) => (sh() === "cmd" ? quote(text) : squote(text))
115
116const fill = (mode: "lines" | "bytes", n: number) => {
117 const code =
118 mode === "lines"
119 ? "console.log(Array.from({length:Number(Bun.argv[1])},(_,i)=>i+1).join(String.fromCharCode(10)))"
120 : "process.stdout.write(String.fromCharCode(97).repeat(Number(Bun.argv[1])))"
121 const text = `${bin} -e ${evalarg(code)} ${n}`
122 if (PS.has(sh())) return `& ${text}`
123 return text
124}
125const glob = (p: string) =>
126 process.platform === "win32" ? Filesystem.normalizePathPattern(p) : p.replaceAll("\\", "/")
127

Callers 3

shell.test.tsFile · 0.70

Calls 2

evalargFunction · 0.85
shFunction · 0.85

Tested by

no test coverage detected