fix(cli): add fish shell completion support - #41336
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. |
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Potential duplicate found:
This PR appears to be directly related to the current PR #41336. Both are addressing the same issue (#41232) and both involve adding/fixing shell completion support with multiple shell types (bash, zsh, fish). PR #41235 also adds shell argument handling to the completion command, which overlaps with the functionality in the current PR. You should check if #41235 is still open and whether it needs to be merged first or if this PR should be rebased on it. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
Thanks for the heads-up! I see PR #41235 already addresses this issue with a more complete implementation including tests. I'll close this PR in favor of that one since it's more complete and already has test coverage. |
|
Closing in favor of PR #41235 which has a more complete implementation with tests. |
Description
Fixes issue #41232 where
opencode completion fishincorrectly emitted bash/zsh completion scripts instead of proper fish syntax.Changes
packages/opencode/src/cli/completion.tswith completion templates for bash, zsh, and fishpackages/opencode/src/index.tsto add a customcompletioncommand that:shellargument (bash,zsh,fish)--bash/-b,--zsh/-z,--fish/-f$SHELLenvironment variable for auto-detectionVerification
opencode completion fish→ outputs fish completion script ✅opencode completion bash→ outputs bash completion script ✅opencode completion zsh→ outputs zsh completion script ✅opencode completion --fish→ outputs fish completion script ✅SHELL=/bin/fish opencode completion→ auto-detects fish ✅SHELL=/bin/zsh opencode completion→ auto-detects zsh ✅SHELL=/bin/bash opencode completion→ auto-detects bash ✅Plugins
N/A
OpenCode version
Current dev branch
Steps to reproduce
opencode completion fishand look at the output. It is now a proper fish completion script.opencode completion fish | source.Screenshot and/or share link
N/A
Operating System
Linux (tested on Arch Linux)
Terminal
Any terminal supporting fish shell