On 4/21/06, Ben Staniford <[EMAIL PROTECTED]> wrote: > Ok, > > I gave a quick go and decided that you were right :-) Man pages are > very varied and can't be relied upon. However, then I decided that > perhaps the job of making completions could be semi automated. I wrote > a bit of perl that will work out what switches and options are available > from the man page and will create a fish script will the relavent > commands for each option. It also puts comments in the fish script to > show some context concerning the option so that you can quickly fill in > the description text. It's only a prototype but see what you think. > > You run it by doing: > > ./opt_sum.pl <command> > > (I've also included a sample output for ls) > > Limitations (it's only a prototype!) > > 1. It currently only does options that look like "-s" or "--long", it > can't do "-onedash" options yet. (So don't use it on the find command). > You can run it by doing:
Something missing here? > > 2. It can't reliably match up -s and --long options into one "complete" > command. No real need to do this, is there? > > 3. It currently can't cope with the idea of multiple man commands for > the same term (it just hokily searches /usr/share/man for the first one > it finds, if that's not the right one then it just produces rubbish). > > 4. I'm sure there's more. One would want to also use the first sentence of the switch description as the completion description. > > I'll fix these things next week :-) This tool can really help automate completion writing. Good job! > > On Friday 21 April 2006 11:16, Axel Liljencrantz wrote: > > On 4/21/06, Ben Staniford <[EMAIL PROTECTED]> wrote: > > > Hi there, > > > > > > I notice that fish uses the man pages to complete man help style > > > completions. But is there any reason that man pages to build command > > > completions, rather than building completions manually? Man pages seem > > > to contain lots of things like OptDef that describe options that are > > > possible for commands. > > > > Man-pages are rather losely structured, while there are many > > conventions, few of them are strictly followed by the individual > > pages, making it a very difficult task to correctly parse the > > structure of a man-page. That said, there is a project called > > doclifter, that tries to do just that. It could probably be used as > > the base for an automatic completion-parser. You are more than > > welcome to give it a try. > > > > > > > > Kind Regards, > > > > > > -- > > > Ben Staniford > > > http://www.staniford.net > > > > > > -- > > Axel > > > > -- > Ben Staniford > (023) 9236 9315 > http://www.staniford.net > > > > > -- Axel ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642 _______________________________________________ Fish-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/fish-users
