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

Re: PATCH: completion for perldoc



Sven Wischnowsky (wischnow@xxxxxxxxxxxxxxxxxxxxxxx) wrote:
> Adam Spiers wrote:
> > I noticed Etc/Completion-style-guide soon after posting and realised
> > the many problems with that _perl* :-(
> 
> Never mind. All this isn't fixed in stone yet and the `style-guide' is 
> quite new.

I've been uploading the style-guide and the _arguments documentation
to my brain, and improved versions are on the way.  _arguments is
great!  However a few things perplex me:

- Why can't you have multiple MESSAGE:ACTION pairs with the
  *:MESSAGE:ACTION form?  I'm having to resort to using an auxiliary
  function, e.g.:

_perldoc {
    _arguments -s \
        '-h:help:' \
        '(-q)-f:Perl built-in function:_perl_builtin_funcs' \
        '(-f)-q:Perl FAQ keyword:' \
        '*:Perl pod pages:_perl_pods'
}

_perl_pods {
    local nm="$compstate[nmatches]"

   _perl_modules
   _perl_basepods
   _path_files -J "Perl modules and .pods" -/ -g '*.(pod|pm)'

    [[ nm -ne compstate[nmatches] ]]
}


- Is it possible to do something like (-foo)*:MESSAGE:ACTION, i.e.
  specifying completion for normal args only if -foo hasn't been
  specified?

> P.P.S.: The function system started as an attempt to make the syntax
>         easier to understand. And now we have a completion function
> 	that explains what it does by giving an equivalent `compctl' ;-)

<rofl>  I hadn't thought of that :-D



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