Command-line completion for Ruby-related commands under Bash: rake, bundle, gem, rails, ruby, jruby
brew install bash-completion
Save the completion files somewhere (in the same directory) and add the following line to your
completion-ruby-allscript loads all the completions it finds, but only for the commands you appear to have installed. Alternatively, you can just save the specific scripts you wish, and source them individually.
Before writing my own, I'd seen about five different scripts for
rakecompletion. None of them, though, at the same time:
...among other minor quirks. While providing all of the above, a few other niceties were added, like command-line options completion and awareness of task arguments.
This script is not perfect (for instance, it won't update the cache if a dependency of the rakefile is updated; as a workaround, simply
touch Rakefile), but it tries to cover all the most common cases without overcomplicating or overthinking the code.
Copyright © 2008-2017 Daniel Luz.
completion-ruby is distributed under the MIT license.
For up-to-date information, visit this project's permalink.