[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] improved bash completion v2

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2005-11-14 21:31:03 CET

First, a note for other readers:

This patch makes Bash suggest different completions in different circumstances:
in particular, if you request completion of an empty word and there is some
required part missing from the command, it only suggests the missing thing. I
wasn't too sure about that idea to begin with, but it seems to work rather well
in practice. For example, it knows that "svn:log" is a revision property:

(An underscore indicates the cursor.)

   $ svn ps svn:log _
   $ svn ps svn:log --revprop _
   $ svn ps svn:log --revprop --revision _
   $ svn ps svn:log --revprop --revision 10 _
   ' --file

It is now suggesting that either a literal value (perhaps starting with a
quote) or the "--file" option is needed. However, if you want to put something
else here you can:

   $ svn ps svn:log --revprop --revision 10 --p_
   $ svn ps svn:log --revprop --revision 10 --password _
   ' --file


I found some bugs:

   $ svn pe --revprop -r10 svn:l_
   $ svn pe --revprop -r10 svn:svn:log

This doesn't happen every time, only when trying that completion for the first
time after trying a different one. Perhaps that indicates an uninitialised
variable or similar.

   $ svn bl_ subversion/clients/cmdline/main.c
   $ svn blank-log-msg.patch subversion/clients/cmdline/main.c

That's the name of a local file; it should complete the subcommand name "blame"
instead. The filename afterwards seems to confuse it.

   $ svn pset svn:mime-type ima_ www/images/jolt-2005.jpg

Similarly, here I expect the completion "image/", but it doesn't recognise that
I'm entering a MIME type.

   $ svn --help_

Bash beeps, presumably because this script returns no results. It should
recognise that there is exactly one completion, and so Bash should quietly
append a space. The same occurs for any already-complete "-" or "--" option
after a subcommand.


I haven't looked much at the code yet, but I saw one little thing:

> + # commands which only expect two arguments
> + # diff has some variant with two arguments, but not all of them.
> + # merge/switch have two or three args variants.
> + twoArgsCmds='copy|cp|move|mv|export|import'

"move" also has aliases "ren" and "rename".

- Julian

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Nov 14 21:32:15 2005

This is an archived mail posted to the Subversion Dev mailing list.