Better bash completion for rake
A while ago, I started searching for decent bash completion for rake. At the time I was disappointed by the available solutions, so I hacked together my own and have been steadily improving it since then. It’s available at gist.github.
I think it still has some advantages over other solutions that have been posted:
It completes long options (
--trace,--execute-print, etc.).It falls back to completing filenames. I find this most useful for running just one set of tests, e.g.:
$ rake test:units TEST=test/unit/bar_test.rb foo_test.rb helpers/ It handles colons for namespaced tasks correctly, without resorting to setting COMP_WORDBREAKS globally.
It doesn’t rely on an external script, which means it only has to fire up one Ruby interpreter (to run
rake) instead of two (to run a Ruby completion script that runsrake).
It doesn’t cache the task list, so it still requires a call to rake --tasks on every <TAB>. I may add caching support later.
Here it is for your inspection and enjoyment:
About this entry
You’re currently reading “Better bash completion for rake,” an entry on Kevin's random thoughts
- Published:
- 12.14.09 / 2pm
- Category:
- tech
- Tags:
- bash, bash completion, cli, command line, completion, rake
No comments
Jump to comment form | comments rss [?] | trackback uri [?]