completion: gem: Fix completion file
parent
a8695edc8f
commit
42695c22d0
|
|
@ -9,23 +9,26 @@ __gem_completion() {
|
||||||
install)
|
install)
|
||||||
# list the remote gems and add to completion
|
# list the remote gems and add to completion
|
||||||
if [ -z "$REMOTE_GEMS" ]; then
|
if [ -z "$REMOTE_GEMS" ]; then
|
||||||
REMOTE_GEMS=($(gem list --remote --no-versions | sed 's/\*\*\* REMOTE GEMS \*\*\*//' | tr '\n' ' '))
|
read -r -a REMOTE_GEMS <<< "$(gem list --remote --no-versions | sed 's/\*\*\* REMOTE GEMS \*\*\*//' | tr '\n' ' ')"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local cur=${COMP_WORDS[COMP_CWORD]}
|
local cur=${COMP_WORDS[COMP_CWORD]}
|
||||||
|
# shellcheck disable=SC2207
|
||||||
COMPREPLY=($(compgen -W "${REMOTE_GEMS[*]}" -- "$cur"))
|
COMPREPLY=($(compgen -W "${REMOTE_GEMS[*]}" -- "$cur"))
|
||||||
|
return 0
|
||||||
;;
|
;;
|
||||||
uninstall)
|
uninstall)
|
||||||
# list all local installed gems and add to completion
|
# list all local installed gems and add to completion
|
||||||
if [ -z "$LOCAL_GEMS" ]; then
|
read -r -a LOCAL_GEMS <<< "$(gem list --no-versions | sed 's/\*\*\* LOCAL GEMS \*\*\*//' | tr '\n' ' ')"
|
||||||
LOCAL_GEMS=($(gem list --no-versions | sed 's/\*\*\* LOCAL GEMS \*\*\*//' | tr '\n' ' '))
|
|
||||||
fi
|
|
||||||
|
|
||||||
local cur=${COMP_WORDS[COMP_CWORD]}
|
local cur=${COMP_WORDS[COMP_CWORD]}
|
||||||
|
# shellcheck disable=SC2207
|
||||||
COMPREPLY=($(compgen -W "${LOCAL_GEMS[*]}" -- "$cur"))
|
COMPREPLY=($(compgen -W "${LOCAL_GEMS[*]}" -- "$cur"))
|
||||||
|
return 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
local commands=(build cert check cleanup contents dependency environment fetch generate_index help install list lock outdated owner pristine push query rdoc search server sources specification stale uninstall unpack update which)
|
local commands=(build cert check cleanup contents dependency environment fetch generate_index help install list lock outdated owner pristine push query rdoc search server sources specification stale uninstall unpack update which)
|
||||||
|
# shellcheck disable=SC2207
|
||||||
COMPREPLY=($(compgen -W "${commands[*]}" -- "$cur"))
|
COMPREPLY=($(compgen -W "${commands[*]}" -- "$cur"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue