Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: GPG completion function



Le lun 17 septembre, Oliver Kiddle a écrit :
> 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.
> 
i believe that some functions declared this var without using them. That's why
i write this line

> > typeset -A opt_args
> 
> I think you only need this if you're going to use it.
> 
ok

> > 	local keys_list
> 
> You don't need that any more but `name' needs to be declared local.
> 

yes, i forgot to remplace keys_list by name (grrr)

> > 	# 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.

i need to read and reread doc, i have some difficulty with pattern matching

> 
> > _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.
> 
i don't understand completely. you mean that i delete all descriptions
(which comes from gpg's manpage) ?

> > 	'-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.
>
ok

> > 	'-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'

ok

it is possible to tell zsh there maybe more than 1 file after the
option ? 

> 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
> 
Thank you very

I'm sorry for my mistakes (i'm beginner, i use zsh since 2 months) and for
my __very__ poor english

> 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

-- 
 Bruno Bonfils
 Admin Sys Linux

 http://www.darksnow.org  http://www.debian-fr.org

 Si la connerie était cotée en bourse,tu serais incarcéré pour
 délit d'initié...
 -+- EB in: Guide du Cabaliste Usenet - Les initiés ont la cote -+-

Attachment: pgpiOzCfqI12S.pgp
Description: PGP signature



Messages sorted by: Reverse Date, Date, Thread, Author