fix: shell completions now work for both bash and zsh#2
Merged
Conversation
- Fix broken zsh completion: replace fpath/compinit autoload approach with direct source + explicit compdef registration - Add _detect_completion_rc_files() to inject completion into all detected shell rc files (bash + zsh), not just the current shell - Rewrite _remove_completions() to clean up all rc files - Keep completion files centralized under ~/.easywork/completions/ - Add 4 new tests: explicit compdef, dual-shell injection, cleanup preserving user content, idempotent injection - Update existing test with zsh compdef and fpath assertions
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.
问题
Zsh 补全静默失效 —
fpath注入时机太晚,compinit已执行完毕。且补全只为当前 Shell 配置。修复
source+ 显式compdef注册(不再依赖 fpath/compinit 自动发现)_detect_completion_rc_files()同时检测 bash 和 zsh 的 rc 文件_remove_completions()遍历所有 rc 文件清理补全行~/.easywork/completions/测试
新增 4 个测试 + 更新 1 个已有测试,全部 115 个测试通过。ShellCheck 通过。