Add completion for yash

Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
This commit is contained in:
Adrien Gallouët 2020-05-04 20:22:49 +00:00
parent 6c27a5ca3d
commit c9cb5bdf84
3 changed files with 13 additions and 2 deletions

View file

@ -34,9 +34,9 @@ Then, run as `root`:
As usual, you can customize the destination with `DESTDIR` and `prefix`. As usual, you can customize the destination with `DESTDIR` and `prefix`.
If you want the tab completion in `bash`, you have to do it manually for now. If you want the tab completion in `bash`, you have to do it manually for now.
Luckily, it's super easy! Just download the file [argz.sh](argz/argz.sh) and then: Luckily, it's super easy! Just download the file [argz.bash](argz/comp/argz.bash) and then:
$ . argz.sh $ . argz.bash
$ complete -F _argz secret $ complete -F _argz secret
It's exactly the same for `zsh` if you have enabled `bashcompinit'. It's exactly the same for `zsh` if you have enabled `bashcompinit'.

11
argz/comp/argz.yash Normal file
View file

@ -0,0 +1,11 @@
function completion/argz {
typeset opts
opts="$($WORDS help 2>/dev/null | awk '{print $1}')"
case "$opts" in
'') ;;
CMD) complete -c;;
DIR) complete -d;;
FILE) complete -f;;
*) complete -- $opts
esac
}