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

Re: Completion for gtar



Bruce Stephens wrote:

> ...
> 
> The function just lists the files in the archive (which is,
> confusingly, the third in the args array, but the second argument in
> the compctl pattern).  Similarly, the check to see whether the archive
> is compressed or not has to check $args[2], whereas it's 'p[1]' in the
> compctl.  And how can I arrange a fallback: suppose the archive
> doesn't exist---how can I get the equivalent of -f or something in
> this case?  Do I write
> 
> 	reply=($1*$2*)
> 
> or something?  (Setting NULL_GLOB as a local option in the function.)
> 

Or you return an empty reply array and use xor'ed completion:

     - 'p[3,-1] W[1,*x*] W[2,^-]' -K gtar_files + -f -- gtar
                                               ^^^^^^


Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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