fix: support fish completion script - #41418
Conversation
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate Found:
This PR appears to address the same issue. Both PRs are focused on handling shell completion scripts properly (bash/zsh/fish) and the current PR #41418 directly references issue #41232 which PR #41235 likely also addresses. The titles suggest they're tackling the same root cause: ensuring the shell argument is properly honored in the completion command. You should verify if PR #41235 is already merged or if these should be consolidated. |
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
Fixes #41232.
yargs 18 only ships bash/zsh completion templates and its built-in \completion\ command picks the template from , ignoring the shell positional argument — so \opencode completion fish\ emitted a bash/zsh script.
Handle an explicit shell positional ourselves before yargs parses: if \completion\ is called with a known shell (bash/zsh/fish), print the right script and exit. Templates for bash/zsh come from yargs main; fish from yargs' fish template.
Verified: \completion fish|zsh|bash\ each emit the correct script; bare \completion\ falls through to yargs as before. 4 unit tests in packages/opencode/test/cli/completion.test.ts pass.