Maybe I should also send to the mailing list ;-)
Well, I cannibalised your __fish_describe_command function into the following
which gets most of the way there. But I don't really know awk so would you
mind helping out a little to save me reading up on it?
Two things; 1: long descriptions get shortened with trailing dots (although
maybe you'd rather keep it this way)
and 2: the 'git-' bit needs to be stripped off the beginning of the names.
apropos git- | awk -v FS=" +- +" '{
split($1, names, ", ");
for (name in names)
if (names[name] ~ /^'"$argv"'.* *\([18]\)/ ) {
sub( "( |\t)*\\\([18]\\\)", "", names[name] );
sub( " \\\[.*\\\]", "", names[name] );
print "complete -c git -a " names[name] " -d \\"" $2 "\\"";
}
}'
Thanks in advance.
Diggory
On Friday 18 January 2008 16:00:47 you wrote:
> On Jan 16, 2008 11:21 AM, Diggory Hardy <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > Here's a few git completions (probably only a very small set of available
> > git commands). But after adding them, I noticed that using tab-completion
> > on 'git-' (possible since git commands are also available using
> > hard-linked binaries 'git-*') not only lists all available commands, but
> > their descriptions too (not ones I added) --- where has fish got their
> > descriptions from? They're not in /usr/share/fish/completions or any
> > other completion dir.
> >
> > Not that it's particularly important, but I'm intrigued and it could
> > provide an easy way to add full tab-completion with descriptions.
>
> Fish calls an internal shellscript function called
> __fish_describe_command in order to find a description for a command.
> Actually, it finds descriptions for all commands beginning with a
> specified prefix, so if you call '__fish_describe_command git' you
> will get a list of descriptions for all git subcommands.
>
> What __fish_describe_command actually does is that it uses the apropos
> command to search the whatis database (which in turn is generated by
> from the manual pages installed in the system). Unfortunatly, the
> definition of the __fish_describe_command is a bit of an abomination,
> because the actual format of the apropos output varies significantly
> between platforms and even between Linux distributions.
>
> Hope that answers you question, and that you'll be sending us a patch
> containing lots of git tab completions soon!
>
>
> Axel
>
> > Diggory
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Microsoft
> > Defy all challenges. Microsoft(R) Visual Studio 2008.
> > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > _______________________________________________
> > Fish-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/fish-users
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users