feat: add fish shell tab completions#23263
Open
nitishagar wants to merge 1 commit intoanomalyco:devfrom
Open
Conversation
Author
|
CI check-duplicates timed out on first run — not related to code changes. Requesting re-run. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #1515
Type of change
What does this PR do?
Adds fish shell tab completion support. Bash/zsh completions already work via yargs' built-in
.completion()method, but fish uses a completely different format (complete -c opencode ...) that yargs can't generate.Changes:
packages/opencode/src/cli/cmd/completion.tswith agenerateFishCompletions()function that outputs a static fish completion script covering all commands, subcommands, options, and choicesindex.ts: whenopencode completion --shell fishis invoked, the fish script is output before yargs processes the args. Existing bash/zsh behavior is completely untouchednix/opencode.nixto install fish completions alongside bash/zshUsage:
The fish script uses standard fish patterns (
__fish_seen_subcommand_from,set -lsubcommand lists) to gate completions properly for nested subcommands likeopencode debug lsp diagnostics.How did you verify your code works?
bun run typecheck— no errors in changed filesbun -e "import { generateFishCompletions } from './packages/opencode/src/cli/cmd/completion.ts'; console.log(generateFishCompletions())"— produces 237 lines of valid fish completion syntax.completion()call and--get-yargs-completionsmechanism are untouchedScreenshots / recordings
N/A — CLI feature, no UI changes.
Checklist