Wednesday, May 04, 2005

Tinkering: Bash and Subversion

Bash has a very handy and (as far as I'm concerned) obscure feature that allows you to specify completion words for commands. This is useful for providing some brief feedback when typing a command line. For example, you can specify the completions for the 'svn' command like this:

complete -W 'add blame praise annotate cat checkout co cleanup commit ci
copy delete del remove rm diff di export help h import info list ls log merge
mkdir move mv rename ren propdel pdel pd propedit pedit pe propget pget
pg proplist plist pl propset pset ps resolved revert status stat st switch sw
update up' svn

This is great when you type 'svn' and then hit the TAB key to get a list of possible completions.

I wish you could specify completions for secondary commands. This would allow me to specify the options for the 'svn commit' versus 'svn diff' versus every other svn command. I hope I've just missed how to do this (despite trying some of the more obvious possibilities). If so, please let me know how it works.

No comments: