Merge pull request #822 from jasonkarns/completion

Add --help and tab completion to rbenv-versions
This commit is contained in:
Mislav Marohnić 2015-11-20 18:37:54 +01:00
commit 5fb9c84e14
4 changed files with 22 additions and 2 deletions

View file

@ -10,6 +10,11 @@ if [ -z "$COMMAND" ]; then
exit 1 exit 1
fi fi
# Provide rbenv completions
if [ "$COMMAND" = "--complete" ]; then
exec rbenv-commands
fi
COMMAND_PATH="$(command -v "rbenv-$COMMAND" || command -v "rbenv-sh-$COMMAND")" COMMAND_PATH="$(command -v "rbenv-$COMMAND" || command -v "rbenv-sh-$COMMAND")"
# --help is provided automatically # --help is provided automatically

View file

@ -18,8 +18,7 @@ set -e
# Provide rbenv completions # Provide rbenv completions
if [ "$1" = "--complete" ]; then if [ "$1" = "--complete" ]; then
echo --usage echo --usage
rbenv-commands exec rbenv-commands
exit
fi fi
command_path() { command_path() {

View file

@ -5,6 +5,17 @@
set -e set -e
[ -n "$RBENV_DEBUG" ] && set -x [ -n "$RBENV_DEBUG" ] && set -x
# Provide rbenv completions
if [ "$1" = "--complete" ]; then
echo -
echo --no-rehash
echo bash
echo fish
echo ksh
echo zsh
exit
fi
print="" print=""
no_rehash="" no_rehash=""
for args in "$@" for args in "$@"

View file

@ -9,8 +9,13 @@ set -e
unset bare unset bare
unset skip_aliases unset skip_aliases
# Provide rbenv completions
for arg; do for arg; do
case "$arg" in case "$arg" in
--complete )
echo --bare
echo --skip-aliases
exit ;;
--bare ) bare=1 ;; --bare ) bare=1 ;;
--skip-aliases ) skip_aliases=1 ;; --skip-aliases ) skip_aliases=1 ;;
* ) * )