Expand zsh compdef patterns - #311
Merged
rsteube merged 3 commits intoJul 11, 2026
Merged
Conversation
… the glob loop Lines like "#compdef -value-,DISPLAY,-default-" were reduced to a bare "#compdef" by the sed option-stripping step. This reached the while loop, matched the glob-character check, and caused an invalid pattern error that aborted the entire loop, dropping all subsequent entries. Filter these bare #compdef strings before the loop so glob expansion runs to completion. Assisted-by: Crush:glm-5.2
A bare #compdef was one bad pattern that aborted the while loop, but malformed globs like unmatched parens or brackets from other zsh completion packages could cause the same failure. Running the expansion in a subshell with stderr suppressed ensures any bad pattern only skips that single entry instead of aborting the entire loop. Assisted-by: Crush:glm-5.2
rsteube
approved these changes
Jul 11, 2026
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.
Closes #261.
This updates zsh bridge command discovery so
#compdefpattern entries are expanded against commands available in PATH instead of being discarded. Literal command entries still pass through the existing filters.Changes:
zsh.sh${(M)${(k)commands}:#${~compdef}}and print matching command namesValidation:
PATH=/tmp/codex-go-toolchain/go/bin:$PATH go test ./...PATH=/tmp/codex-go-toolchain/go/bin:$PATH go test ./cmd/...PATH=/tmp/codex-go-toolchain/go/bin:$PATH go build ./cmd/carapace-bridgegit diff --checkpkg/bridges/zsh.shwith a locally extracted zsh package, a fake fpath containing#compdef (ruby|[ei]rb)[0-9.]# python[0-9.]# plain ..., and fake PATH commands; it emitted matching commands such asruby,ruby3.2,erb,erb3,irb2,python3, andplainwhile filtering special/private entries.