From 9fbaa73a0f622738e3e1f4c2675fb7c964dda35b Mon Sep 17 00:00:00 2001 From: Julien Nicoulaud Date: Thu, 17 Nov 2011 15:43:50 +0100 Subject: [PATCH] #36 vpnc: handle vpnc-disconnect too --- _vpnc | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/_vpnc b/_vpnc index bc2d859..49367df 100644 --- a/_vpnc +++ b/_vpnc @@ -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