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

Re: Generating completion functions from XML

Felix Rosencrantz wrote:

> ...
> But I suspect any scripts would still hit some sort of 90/10 rule.      
> It'll get you 90% of the way but there will still be the final 10%      
> which will have to be done manually.                                    

It might be useful if it manages to automate more than 50% of the
process, leaving the rest to the user...

> So I feared having to look at partially wrong _arguments calls.  That   
> command has a lot of syntactic sugar and there is more on the way (e.g. 
> recent changes).  It's not easy for me to remember what each special    
> character and grouping does.                                            

Actually, the reason why some of the _argument calls hurt the eyes is
that it has so littly syntactic sugar.

And I hope there won't be any changes to the _arguments syntax (or at
least nothing dramatic).  That's part of the reason why I used `same
description' as the condition on which to group in _describe.

> It occurred to me that having an intermediate file format would be a    
> good idea.  Possibly something that would be a little more descriptive, 
> maybe even interspersed with comments and documentation (both from      
> zsh & the command).  Also it should be easier to edit.  Also, it        
> should make it easier to specify commands that have subcommands (e.g.   
> cvs).  There would need to be a tool which transform this intermediate  
> file format into the appropriate completion function, generating the    
> appropriate call to _arguments, _values, etc.  Also, as the syntax to   
> _arguments changed it would be possible to change this generation tool, 
> and then regenerate the completion function.  Maybe even _arguments     
> could even take this intermediate format file as input.                 

Btw. have you noticed Bart's _arg_compile function?

I'm not opposed to defining some language to make describing commands
easier at all.  Be it XML or something else (everything has to be XML
nowadays, right? at least until the next hype... ;-).

But it's not simple to define, really.  Especially if you think about
commands like _cvs which does *a lot* besides calling _arguments, things
that are best described with the shell code needed to do them, I think.

I'll try to make helpful comments when you start describing the language
you have in mind.


Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx

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