To my surprise there apparently hasn’t been support for bash command
line completion for the gem command. I’ve cobbled together a file that
add just that. See
I’ve only tested it on Debian/Linux, on other Linux/Unix variants things
might work somewhat differently. Also, I don’t even try to do
completion for gem names; doing that for remote gems would be much to
slow and I haven’t looked into getting that information from the local
source_cache.
source_cache.
I have this in my tcsh completions.rc, it provides basic command
completion and completion for installed gems:
set gemcommands=(build cert check cleanup repository contents
dependency environment help install list outdated pristine
query rdoc search sources specification uninstall unpack
update repository)
complete gem ‘p/1/$gemcommands/’ ‘n/help/$gemcommands/’
‘p%%D:/usr/local/lib/ruby/gems/1.8/gems/% %’ 'n//f:*/’
I haven’t bothered with option completion, but of course that can be
added with a similar effort to yours.
Remote gems should indeed be doable; it would mostly need a fast command
to dump a list of gem names, or have something write them to a text file
beforehand. If the full list is too big for that to be reasonable, the
plaintext index could be split by prefix.
slow and I haven’t looked into getting that information from the local
source_cache.
Michael
Hi Michael,
Thanks for the script.
I’ve had a go at hacking in gem name completion for install and
uninstall. For uninstall it uses installed names, for install it uses
the names in the source cache. Only tested with gem 0.9.1.