Permalink
Browse files

Refactored gem completion to load gem lists on demand intead of on load

  • Loading branch information...
1 parent 55c32cc commit 484c57b7d22bad8797f073951c5f0682bb1c5921 @victorcoder victorcoder committed Jul 25, 2011
Showing with 10 additions and 10 deletions.
  1. +10 −10 completion/available/gem.completion.bash
@@ -1,22 +1,22 @@
#!/usr/bin/env bash
# Completion for gem
-if [ -z "$REMOTE_GEMS" ]
-then
- REMOTE_GEMS=( $(gem list --remote --no-versions | tr '\n' ' ') )
-fi
-
-if [ -z "$LOCAL_GEMS" ]
-then
- LOCAL_GEMS=( $(gem list --no-versions | sed 's/\*\*\* LOCAL GEMS \*\*\*//' | tr '\n' ' ') )
-fi
-
_installcomp() {
+ if [ -z "$REMOTE_GEMS" ]
+ then
+ REMOTE_GEMS=( $(gem list --remote --no-versions | tr '\n' ' ') )
+ fi
+
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen -W "${REMOTE_GEMS[*]}" -- $cur) )
}
_uninstallcomp() {
+ if [ -z "$LOCAL_GEMS" ]
+ then
+ LOCAL_GEMS=( $(gem list --no-versions | sed 's/\*\*\* LOCAL GEMS \*\*\*//' | tr '\n' ' ') )
+ fi
+
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen -W "${LOCAL_GEMS[*]}" -- $cur) )
}

0 comments on commit 484c57b

Please sign in to comment.