feat: Add shell autocompletion support for bash and zsh#43
feat: Add shell autocompletion support for bash and zsh#43stjuan627 wants to merge 1 commit intojohnlindquist:mainfrom
Conversation
Add `wt completion bash/zsh` command that outputs shell completion scripts, and a hidden `wt __complete` command for dynamic candidate generation. Completions include worktree branches for merge/remove/open, git branches for new/setup/extract, and static subcommands for config.
📝 WalkthroughWalkthroughAdds comprehensive shell autocompletion support for bash and zsh shells to the CLI. Includes a new Changes
Sequence DiagramsequenceDiagram
participant User as User/Shell
participant CLI as CLI (wt)
participant Complete as __complete Handler
participant Logic as getCompletions
participant Git as Git Utils
participant Shell as Shell Registration
User->>CLI: Start typing 'wt new [TAB]'
CLI->>Complete: Invokes __complete with words
Complete->>Logic: Calls getCompletions(['new', 'partial'])
Logic->>Git: Detects 'new' command, calls getBranches()
Git-->>Logic: Returns ['main', 'feature-x', 'feature-y']
Logic-->>Complete: Filters and returns matching branches
Complete-->>CLI: Outputs candidates to stdout
CLI->>Shell: Returns completion suggestions
Shell-->>User: Displays matching branches for [TAB]
rect rgba(100, 150, 200, 0.5)
Note over User,Shell: Initial Shell Setup
User->>CLI: Run 'wt completion bash'
CLI->>Complete: completionHandler('bash')
Complete-->>User: Outputs bash completion script
User->>Shell: Evaluates script, registers _wt_completions
Shell-->>User: Completion ready for future use
end
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Add
wt completion bash/zshcommand that outputs shell completion scripts, and a hiddenwt __completecommand for dynamic candidate generation. Completions include worktree branches for merge/remove/open, git branches for new/setup/extract, and static subcommands for config.Summary by CodeRabbit
New Features
Documentation