zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Bruno Bonfils <asyd@debian-fr.org>
Cc: zsh-workers <zsh-workers@sunsite.dk>
Subject: Re: GPG completion function
Date: Mon, 17 Sep 2001 15:07:18 +0100	[thread overview]
Message-ID: <3BA60396.7EB63F80@yahoo.co.uk> (raw)
In-Reply-To: <20010917000505.A5637@debian-fr.org>

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


  reply	other threads:[~2001-09-17 14:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-16 22:05 Bruno Bonfils
2001-09-17 14:07 ` Oliver Kiddle [this message]
2001-09-17 14:17   ` Bruno Bonfils
2001-09-17 16:15   ` Bruno Bonfils
2001-09-17 19:45     ` new version of " Bruno Bonfils
2001-09-18 13:43     ` Oliver Kiddle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3BA60396.7EB63F80@yahoo.co.uk \
    --to=okiddle@yahoo.co.uk \
    --cc=asyd@debian-fr.org \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).