From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15686 invoked from network); 7 May 2008 19:36:29 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,HTML_MESSAGE autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 7 May 2008 19:36:29 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 3399 invoked from network); 7 May 2008 19:36:23 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 7 May 2008 19:36:23 -0000 Received: (qmail 8890 invoked by alias); 7 May 2008 19:36:18 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24963 Received: (qmail 8871 invoked from network); 7 May 2008 19:36:18 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 7 May 2008 19:36:18 -0000 Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.226]) by bifrost.dotsrc.org (Postfix) with ESMTP id D636080ED172 for ; Wed, 7 May 2008 21:36:12 +0200 (CEST) Received: by rv-out-0506.google.com with SMTP id g37so465508rvb.21 for ; Wed, 07 May 2008 12:36:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=yox9VaUus2imBoWL/c8jpGSjVPfga2rAiGHwWJJfGpE=; b=ExyeQqWT392pIyyXF1FJ3gQC8WN5NQQ4V67ZP89U1q/ZJs4EEwdTemvFn/A6p8mPa2E4IiQMce1aKlIOMEfenFDPU5nUheS/QTOqcR0tBbofmtNvYLSRwdp9lH06vCi2az1U3Z0SifrV+kgVVy9OR6v6TfHXOVPmm52PjtPXUVg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=WQ/F0BV8tAE1hRS3S1of884bsJxoz/udRn8wj4UKmi9n4wsu0TpXJaVu0rfrEMnZom+AzHbwxpxNjJjnBZrwg3EQ6HVYrLVd4G51FaM0qh7dONW86cCT7tJg8zxHvl+wfGYSH24t9ldBMTnHAdLIZbe3kQMu/3u+hzxPGHZFKMU= Received: by 10.140.207.2 with SMTP id e2mr1133090rvg.104.1210188971327; Wed, 07 May 2008 12:36:11 -0700 (PDT) Received: by 10.141.77.5 with HTTP; Wed, 7 May 2008 12:36:11 -0700 (PDT) Message-ID: <563731560805071236i57041329v9585b8d7c9c0e1d8@mail.gmail.com> Date: Wed, 7 May 2008 15:36:11 -0400 From: "praful mathur" To: zsh-workers@sunsite.dk Subject: ZSH-Completion help In-Reply-To: <563731560805071048y62366ca5y2c60030eef9cdd31@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_23216_3481849.1210188971335" References: <563731560805071048y62366ca5y2c60030eef9cdd31@mail.gmail.com> X-Virus-Scanned: ClamAV 0.91.2/7050/Wed May 7 20:48:51 2008 on bifrost X-Virus-Status: Clean ------=_Part_23216_3481849.1210188971335 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hey, I was wondering if it's possible to append variables such as _host or create a custom variable in the arguments array. I just need to append :0.0 and similar things to other variables such as users. I tried to follow: http://www.linux-mag.com/id/1106 and I used the state variable but it failed for me. Then I tried to use something like: _myhosts=( ${(f)"$(<~/devel/imp_outs/hosts | sed 's/$/:0.0/')"} ) but that messed up horribly. Also, I wanted to know how can I create an argument that is a colon separated value of _users. For example, if I use a certain flag I want to be able to do something like: mycommand -userflag user1:user2:user3 with all the users being tab completed from the _users variable. It should stop when I enter a space. Another thing I tried to do was get only one command to tab complete so you should only complete one command, so the following would be illegal: mycommand cmd1 cmd1 mycommand cmd1 cmd2 My code is as follows: > #compdef mycommand > > local arguments state > > arguments=( > > #append :0.0 to this > '(-d)-d[set display to display]:display:_hosts' > > #if this flag is set, none other should complete > '(-h -a -b -d -g -i -k -m -n -p -r -s -v -w -x)-h[prints help message]' > > #needs to continue completion from _users after : > '(-m)-m[email to colon separated value of emails ]:colon separated > emails:_users' > > > #this errors by showing me files too, not just directories after all > #directories have been exhausted in the given path > '(-p)-p[use PATH as thedirectory]:path:_files -/' > > #only one command should complete with mycommand > '*:commands:(cmd cmd1 cmd2 cmd3)' > ) > > > So I'm trying to do these things: mycommand -h (shows nothing) mycommand cmd1 (shows nothing) mycommand -p (show directories) mycommand -d (show all hosts appended with :0.0) mycommand -m user1: (shows all users) ____________ dasickis ------=_Part_23216_3481849.1210188971335 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hey,

I was wondering if it's possible to append variables such as _host or create a custom variable in the arguments array. I just need to append :0.0 and similar things to other variables such as users. I tried to follow:
and I used the state variable but it failed for me. Then I tried to use something like:
_myhosts=( ${(f)"$(<~/devel/imp_outs/hosts | sed 's/$/:0.0/')"} )
but that messed up horribly.

Also, I wanted to know how can I create an argument that is a colon separated value of _users. For example, if I use a certain flag I want to be able to do something like:
mycommand -userflag user1:user2:user3
with all the users being tab completed from the _users variable. It should stop when I enter a space.

Another thing I tried to do was get only one command to tab complete so you should only complete one command, so the following would be illegal:
mycommand cmd1 cmd1
mycommand cmd1 cmd2

My code is as follows:
#compdef mycommand

local arguments state


arguments=(

#append :0.0 to this

 '(-d)-d[set display to display]:display:_hosts'

#if this flag is set, none other should complete

 '(-h -a -b -d -g -i -k -m -n -p -r -s -v -w -x)-h[prints help message]'

#needs to continue completion from _users after :

'(-m)-m[email to colon separated value of emails ]:colon separated emails:_users'


#this errors by showing me files too, not just directories after all
#directories have been exhausted in the given path
 '(-p)-p[use PATH as thedirectory]:path:_files -/' 


#only one command should complete with mycommand
 '*:commands:(cmd cmd1 cmd2 cmd3)'
)



So I'm trying to do these things:
mycommand -h <TAB> (shows nothing)
mycommand cmd1 <TAB> (shows nothing)
mycommand -p <TAB> (show directories)
mycommand -d <TAB> (show all hosts appended with :0.0)
mycommand -m user1:<TAB> (shows all users)
____________
dasickis
------=_Part_23216_3481849.1210188971335--