From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10551 invoked from network); 3 Feb 2003 22:48:59 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 3 Feb 2003 22:48:58 -0000 Received: (qmail 25815 invoked by alias); 3 Feb 2003 22:48:33 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5865 Received: (qmail 25806 invoked from network); 3 Feb 2003 22:48:32 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 3 Feb 2003 22:48:32 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [192.77.186.1] by sunsite.dk (MessageWall 1.0.8) with SMTP; 3 Feb 2003 22:48:32 -0000 Received: from elvirus.progress.com (elvirus [192.77.186.100]) by pscgate.progress.com (8.12.6/8.12.6/PSC-5.06) with ESMTP id h13MmX1s024833 for ; Mon, 3 Feb 2003 17:48:34 -0500 (EST) Received: from progress.com (localhost [127.0.0.1]) by elvirus.progress.com (8.10.2/8.10.2/PSC-4.01) with ESMTP id h13MmXj03807 for ; Mon, 3 Feb 2003 17:48:33 -0500 (EST) Received: from naserv.bedford.progress.com (naserv [172.16.5.174]) by progress.com (8.11.6/8.11.6) with ESMTP id h13MmWG02650 for ; Mon, 3 Feb 2003 17:48:32 -0500 (EST) Received: from progress.com by naserv.bedford.progress.com (iPlanet Messaging Server 5.2 HotFix 1.03 (built Oct 1 2002)) with ESMTP id <0H9R00K018OWW2@naserv.bedford.progress.com> for zsh-users@sunsite.dk; Mon, 03 Feb 2003 17:48:33 -0500 (EST) Date: Mon, 03 Feb 2003 17:48:31 -0500 From: Bill Burton Subject: Completing on options in name=value format? To: Zsh Users List Message-id: <3E3EF1BF.8040403@progress.com> Organization: Progress Software Corporation MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3a) Gecko/20021212 Hello, I'm writing a completion function for some home grown scripts that require options in the format name=value. I'm having two problems with my function: The command is as follows with the area and pf options required but the test option is not: startws area= \ pf= test={yes|no} In order to complete the pf option, the area option must be specified first. The function mostly works but I still have the following issues: 1. After I complete on the area= option, it still shows up on the completion menu. 2. The .pf suffix for the filename on the pf option isn't stripped off. 3. After completing an option and its argument, there's an extranious "=" appended to the end: startws area=intra= Upon entering a space, it's removed but it shouldn't be there to begin with. This is the function so far: #compdef startws servedb shutdb local curcontext="$curcontext" state line expl area_dirs typeset -A val_args case "$service" in startws|servedb|shutdb) _values -C -s = "Options" \ 'area[area directory]:area:->areas' \ 'pf[parameter file]:parameter file:->pf' \ 'test[test or trace mode]::test:(yes no)' \ && return 0 ;; esac [[ -n "$state" ]] && case "$state" in areas) # directories contain a conf/ subdir one or two levels down area_dirs=( ${BASEDIR:-/usr/local}/*/conf ${BASEDIR:-/usr/local}/*/*/conf ) # TODO: filter out certain directories # lop off the prefix, i.e. /usr/local/ and /conf suffix area_dirs=( ${${area_dirs#${BASEDIR:-/usr/local/}}%/conf} ) compadd -qS = -a area_dirs ;; pf) local area for w in $words; do case "$w" in area=*) area=${w#area=} break; ;; esac done # BUG: -s .pf doesn't strip off the .pf suffix [[ -n $area ]] && compadd -f -W ${BASEDIR:-/usr/local}/${area}/conf/ -g \*.pf -s .pf ;; esac return 1 Thanks for any assistance, -Bill