From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4711 invoked from network); 17 Sep 2001 14:08:45 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 17 Sep 2001 14:08:45 -0000 Received: (qmail 9935 invoked by alias); 17 Sep 2001 14:08:37 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15826 Received: (qmail 9920 invoked from network); 17 Sep 2001 14:08:36 -0000 X-VirusChecked: Checked Sender: kiddleo@cav.logica.co.uk Message-ID: <3BA60396.7EB63F80@yahoo.co.uk> Date: Mon, 17 Sep 2001 15:07:18 +0100 From: Oliver Kiddle X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.15 i686) X-Accept-Language: en MIME-Version: 1.0 To: Bruno Bonfils CC: zsh-workers Subject: Re: GPG completion function References: <20010917000505.A5637@debian-fr.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Bruno Bonfils wrote: > > i submit you my first completion function (for gpg) > > i don't have finish completely, but i send you in order > to have comments/idea. Looks good. Let us know when it is finished and we can include it in the distribution. > _any_ comments/ideas are welcome Mainly it looks fine. I've added a few comments though within limits as I'm not familiar with usage of gpg. > local context state line You only need these declared if you use states with _arguments. With -C to _arguments the form would be slightly different actually. I suspect the final version may use states though. > typeset -A opt_args I think you only need this if you're going to use it. > local keys_list You don't need that any more but `name' needs to be declared local. > # i must rewrite this line using pattern matching > for name in `gpg --list-keys | awk '/^pub/ { print $NF }' | tr "<|>" -d` > do > compadd "$name"; > done As you say in the comment this could be rewritten with a zsh substitution using pattern matching. You then shouldn't need the for loop. It could do with then using _wanted with the compadd to assign a tag and description. Also, you will need to redirect stderr from gpg --list-keys so anyone who hasn't used gpg ever will get nothing completed instead of error messages. > _arguments -C -s \ > '-a[create ASCII armored output]' \ > '-o[write output to file]:_files attachment:_files' \ Your description on that line and others is messed up. I'd need to know more about gpg usage but the file attachment maybe could be completed with a '1' or '*' spec to _arguments. > '-u[use name as the user ID to sign]'\ I think that needs to be -u+[... The plus indicates that the username can be specified imediately after -u without a space, or a space can be used. > '-s[sign a file]:file attachment:_files' \ I see that options like this have a long form as well. Zsh 4.1.x can recognise this and list them together so I'd suggest using something like: '(-s --sign)'{-s,--sign}'[sign a file]:file attachment:_files' It seems that you still have a few gpg options to add to it. There are also no exclusion lists - I take it that -e and -s can not be used together for example. I hope that is helpful Oliver _____________________________________________________________________ This message has been checked for all known viruses by the MessageLabs Virus Scanning Service. For further information visit http://www.messagelabs.com/stats.asp