[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 _
   <TAB>
   $ svn ps svn:log --revprop _
   <TAB>
   $ svn ps svn:log --revprop --revision _
   10
   $ svn ps svn:log --revprop --revision 10 _
   <TAB>
   <BEEP>
   <TAB>
   ' --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_
   <TAB>
   $ svn ps svn:log --revprop --revision 10 --password _
   <TAB>
   <BEEP>
   <TAB>
   ' --file

-------------------------------

I found some bugs:

(1)
   $ svn pe --revprop -r10 svn:l_
   <TAB>
   $ 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.

(2)
   $ svn bl_ subversion/clients/cmdline/main.c
   <TAB>
   $ 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
   <TAB>
   <BEEP>

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

(3)
   $ svn --help_
   <TAB>
   <BEEP>

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.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.