mirror of
https://github.com/x-motemen/ghq.git
synced 2026-09-10 07:26:27 -04:00
zsh completion
This commit is contained in:
parent
f7bf6ed8d7
commit
503233af82
30
zsh/_ghq
Normal file
30
zsh/_ghq
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#compdef ghq
|
||||
|
||||
function _ghq () {
|
||||
_arguments -C \
|
||||
'1:: :__ghq_commands' \
|
||||
'2:: :->args' \
|
||||
&& return 0
|
||||
|
||||
case $state in
|
||||
(args)
|
||||
case $line[1] in
|
||||
(look)
|
||||
_repos=( ${(f)"$(ghq list --unique)":gs/:/\\:/} )
|
||||
_describe Repositories _repos
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
__ghq_commands () {
|
||||
_c=(
|
||||
${(f)"$(ghq help | perl -nle 'print qq(${1}[$2]) if /^COMMANDS:/.../^\S/ and /^ (\w+)(?:, \w+)?\t+(.+)/')"}
|
||||
)
|
||||
|
||||
_values Commands $_c
|
||||
}
|
||||
|
||||
compdef _ghq ghq
|
||||
Loading…
Reference in a new issue