#36 vpnc: handle vpnc-disconnect too

This commit is contained in:
Julien Nicoulaud 2011-11-17 15:43:50 +01:00
parent 0b4fbda2ca
commit 9fbaa73a0f
1 changed files with 23 additions and 4 deletions

27
_vpnc
View File

@ -1,4 +1,4 @@
#compdef vpnc vpnc-connect
#compdef vpnc vpnc-connect vpnc-disconnect
# ------------------------------------------------------------------------------
# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
# All rights reserved.
@ -42,6 +42,25 @@
# ------------------------------------------------------------------------------
# FIXME /etc/vpnc/ is only accessible to root, how do we deal with this ?
local confs; confs=(/etc/vpnc/*.conf(:t:s/\.conf/))
_describe -t confs 'VPNC conf' confs
(( $+functions[_vpnc-connect] )) ||
_vpnc-connect() {
_arguments \
'*: :_vpnc_confs'
}
(( $+functions[_vpnc-disconnect] )) ||
_vpnc-disconnect() {
_message 'no more arguments'
}
(( $+functions[_vpnc_confs] )) ||
_vpnc_confs() {
# FIXME /etc/vpnc/ is only accessible to root, how do we deal with this ?
local confs; confs=(/etc/vpnc/*.conf(:t:s/\.conf/))
_describe -t confs 'VPNC conf' confs "$@"
}
case $service in
vpnc|vpnc-connect) _call_function ret _vpnc-connect && return ret ;;
vpnc-disconnect) _call_function ret _vpnc-disconnect && return ret ;;
esac