zsh/compdef/_vcs
2013-03-15 08:39:43 +01:00

26 lines
496 B
Plaintext

#compdef gpl gst
_gpl() {
if [[ "$VCS_DETECTED" == "hg" ]]; then
words=( hg pull "${(@)nw}"); (( CURRENT++ )); _hg
elif [[ "$VCS_DETECTED" == "hg" ]]; then
words=( svn update "${(@)nw}"); (( CURRENT++ )); _svn
else
words=( git pull "${(@)nw}"); (( CURRENT++ )); service=git; _git
fi
}
_gst() {
words=( git status "${(@)nw}"); (( CURRENT++ )); service=git; _git
}
nw=("${(@)words[2,$]}")
case "$service" in
gpl)
_gpl "$@" && return 0
;;
gst)
_gst "$@" && return 0
;;
esac