Add bash-completion

This commit is contained in:
Yasuhiro Matsumoto 2019-12-24 15:25:03 +09:00
parent bb059e45e7
commit f99b497b6f
No known key found for this signature in database
GPG key ID: 622DE34DC490584B
2 changed files with 20 additions and 0 deletions

20
misc/bash/_ghq Normal file
View file

@ -0,0 +1,20 @@
function _ghq () {
local cur prev words cword
_init_completion || return
case $cword in
1)
COMPREPLY=( $(compgen -W "get list look" -- $cur) );;
2)
case $prev in
get)
COMPREPLY=( $(compgen -W "$(ghq list --unique)" -- $cur) );;
list|look)
COMPREPLY=( $(compgen -W "$(ghq list)" -- $cur) );;
esac;;
*)
COMPREPLY=( $(compgen -W "$(ls)" -- $cur) );;
esac
}
complete -F _ghq ghq