feat: add --generate-completion for shell tab completion

- Add clap_complete dependency for bash/zsh/fish/elvish/powershell
- Add --generate-completion <shell> flag that prints completion script to stdout
- profile.bash sources completions via command keep --generate-completion bash
- @ and @@ aliases get completions via wrapper functions that delegate to _keep
- README updated with Shell Completion section
This commit is contained in:
2026-03-14 11:02:38 -03:00
parent 158bf50864
commit 1a8ed56b68
6 changed files with 58 additions and 0 deletions

View File

@@ -90,6 +90,24 @@ source $KEEP_BASH_PROFILE
The modulefile prepends `keep/bin` to `PATH` and sets `KEEP_BASH_PROFILE` pointing to `profile.bash`.
### Shell Completion
Tab completion is available for `bash`, `zsh`, `fish`, `elvish`, and `powershell`.
**Bash** — add to `~/.bashrc`:
```sh
. <(keep --generate-completion bash)
```
**Zsh** — add to `~/.zshrc`:
```sh
. <(keep --generate-completion zsh)
```
**With `profile.bash`**: Completions for `keep`, `@` (save), and `@@` (get) are loaded automatically when sourcing `profile.bash`.
### Build with Server/Client Features
```sh