Add zsh completion

Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
This commit is contained in:
Adrien Gallouët 2021-01-15 13:38:41 +00:00
parent 72e3b4106b
commit 19d58f5d2e
3 changed files with 18 additions and 9 deletions

View file

@ -56,27 +56,36 @@ Typically if you want to change the default `/usr/local` prefix:
### Tab completion ### Tab completion
Tab completion works with `bash` and `yash` (`zsh` is also supported if you enable `bashcompinit`). Tab completion works with `bash`, `zsh` and `yash`.
Unfortunately, it doesn't work out of the box, you have to setup it manually. Unfortunately, it doesn't work out of the box, you have to setup it manually.
Luckily, it's super easy! Luckily, it's super easy!
Download the file corresponding to your shell: Download the file corresponding to your shell:
- [argz.bash](https://github.com/angt/argz/blob/dev/comp/argz.bash)
- [argz.yash](https://github.com/angt/argz/blob/dev/comp/argz.yash)
Then you can add these lines in your `.bashrc` (or `.zshrc`): - [argz.bash](https://raw.githubusercontent.com/angt/argz/master/comp/argz.bash)
- [argz.yash](https://raw.githubusercontent.com/angt/argz/master/comp/argz.yash)
- [argz.zsh](https://raw.githubusercontent.com/angt/argz/master/comp/argz.zsh)
Then, for `bash`, you can add these lines in your `.bashrc`:
. YOUR_PATH_TO/argz.bash
. argz.bash
complete -F _argz secret complete -F _argz secret
Or in your `.yashrc`: For `yash`, in your `.yashrc`:
. argz.yash . YOUR_PATH_TO/argz.yash
function completion/secret { function completion/secret {
command -f completion//reexecute argz command -f completion//reexecute argz
} }
And finally, for `zsh`, in your `.zshrc`:
. YOUR_PATH_TO/argz.zsh
compdef _argz secret
Completion for secrets is only available in a trusted shell. See below. Completion for secrets is only available in a trusted shell. See below.
## Commands ## Commands

2
argz

@ -1 +1 @@
Subproject commit eb8b122247bd48b11984ae4f8755ae6a4059e6c2 Subproject commit 326e4c9f8b830aae4921a3a43c6a477027431408

@ -1 +1 @@
Subproject commit a4de6e098b5bbbd5389eb8058130f782b53826c3 Subproject commit 5c5d513093075f7245ea522101b17c50aa579af2