ZSH Completion for CLI Tool | Generated by AI
Here’s the full summary:
What was built:
- Completion script: /Users/lzwjava/projects/ww/completions/_ww
- 476 lines of zsh completion code
- Covers all 33 top-level command groups
- Covers all subcommands for each group (github, git, macos, image, proc, utils, java, network, search, pdf, copilot, sync, read, llm, openrouter, env, display, degree, whisper, host, linux, cloudflare, ghostty, clash, latest, note, screenshot)
- Covers nested sub-subcommands (e.g. sync bashrc back/forth, sync hermes back/forth)
- Covers flags (–no-push, –only-message, –json, –days, –model, –debug, –top-k, –pages, –dir, –type)
- Covers file completions where appropriate (whisper -> audio files, marp/pdf -> .md files, read index -> directories)
- CLI commands added to ww/main.py:
ww completion install— copies _ww to ~/.zsh/completions/ and prints setup instructionsww completion script— prints the completion script to stdout- Help text updated with “Completion:” section
- Shell configuration:
- Added
fpath=(~/.zsh/completions $fpath)andautoload -Uz compinit && compinitto ~/.zprofile (line 70-72) - Also present in ~/.zshrc (line 24-25) for non-Ghostty terminals
- .zprofile is the one that matters — Ghostty sources it on startup
- Added
- Files changed:
- ww/main.py — added completion handler + help text
- completions/_ww — new zsh completion script
- ~/.zprofile — added fpath + compinit
Git: committed as 1eed8fc on main, pushed to origin.
To verify after restarting Ghostty:
ww