x-motemen.ghq/misc/bash/_ghq
2019-12-30 22:02:50 +09:00

21 lines
415 B
Plaintext

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