Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/cli/test/completions.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { expect, test } from "bun:test"
import path from "node:path"

test("zsh completion does not define the first positional twice", async () => {
const proc = Bun.spawn([process.execPath, path.join(import.meta.dir, "../src/index.ts"), "--completions", "zsh"], {
stdout: "pipe",
stderr: "pipe",
})
const output = await new Response(proc.stdout).text()
const error = await new Response(proc.stderr).text()

expect(await proc.exited, error).toBe(0)
expect(output).toContain("'1:command:->command'")
expect(output).not.toContain("':Directory to start OpenCode in:'")
})
28 changes: 28 additions & 0 deletions patches/effect@4.0.0-beta.83.patch
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,31 @@ index f2920365cf0328146523ce2e2dba04d6a8809a4a..5482d635cdf01a72063ff683d244fab8
/**
* Creates a streaming `Uint8Array` success response schema.
*
diff --git a/dist/unstable/cli/internal/completions/zsh.js b/dist/unstable/cli/internal/completions/zsh.js
--- a/dist/unstable/cli/internal/completions/zsh.js
+++ b/dist/unstable/cli/internal/completions/zsh.js
@@ -102,9 +102,7 @@ const generateFunction = (descriptor, parentPath, lines) => {
lines.push(` ${spec}`);
}
}
- for (const arg of descriptor.arguments) {
- lines.push(` ${argSpec(arg)}`);
- }
+ // Positional specs conflict with the explicit first-position subcommand dispatcher in Zsh.
lines.push(` '1:command:->command'`);
lines.push(` '*::arg:->args'`);
lines.push(` )`);
diff --git a/src/unstable/cli/internal/completions/zsh.ts b/src/unstable/cli/internal/completions/zsh.ts
--- a/src/unstable/cli/internal/completions/zsh.ts
+++ b/src/unstable/cli/internal/completions/zsh.ts
@@ -133,9 +133,7 @@ const generateFunction = (
lines.push(` ${spec}`)
}
}
- for (const arg of descriptor.arguments) {
- lines.push(` ${argSpec(arg)}`)
- }
+ // Positional specs conflict with the explicit first-position subcommand dispatcher in Zsh.
lines.push(` '1:command:->command'`)
lines.push(` '*::arg:->args'`)
lines.push(` )`)
Loading