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

Re: Zsh Completion function generation via XML

Sven Wischnowsky wrote:
>Felix Rosencrantz wrote:
>> ... [XML stuff]
>That looks friendlier than before.  Only two remarks:
>>       _arguments  \
>>               ...
>>               '*:Handling Tag _files:->_files'
>There should at least be a `&& return 0' after the last spec.
Thanks.  I'll add that in.

>But, and that's the second remark, I strongly suggest that you don't
>use states for every action, or states at all.  They actually are the
>worst case for _arguments, because it has to give up control. It's
>also the most complicated and probably far from bug-free. Ahem.
>Maybe use small sub-functions if you can't be bothered to find out if
>the action can be put into the specs themselves.

Actually that something that can be configured in arg.xsl.  The arg.xsl
stylesheet has a parameter, the way you can hand an argument to an XSLT
script.  This the comment, I default to "state":  ActionTagGeneration
says how to generate an action where only an action tag is available.
Current values are:

    state     The action tag is used as a state name. (default)
    handler   The action tag is used as the argument to a function call of the
               function named '{$FunctionPrefix}_handle'
    default   Use the default action template.
    error     Fail if an action tag that is not defined is used.
<xsl:param name="ActionTagGeneration" select="'state'"/>

When I was doing the clearcase completion, I was using something closer
to 'handler', which would generate calls to clearcase_* functions.  The
problem with that is the user had to write/stub those functions, or
there would be a lot of errors.  (Though I guess my script could stub

I guess what I'm hoping, is that I give help2simple.pl some heuristics
for picking appropriate type functions (i.e. functions under the
Completion/*/Type) for arguments.  The heuristics would be common
sense things, like if the argument name is pid, then guess _pids, or
the argument name ends in "dir" use "_files -/". So there will be less
states.  In addition to heuristics, allow the user to specify the mapping
of argtag names to functions.  (Of course, there needs to be a completion
function for help2simple.pl... :) )


Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!

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