You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 line
699 B

  1. #!/usr/bin/env bash
  2. set -e
  3. [ -n "$RBENV_DEBUG" ] && set -x
  4. # Provide rbenv completions
  5. if [ "$1" = "--complete" ]; then
  6. echo --sh
  7. echo --no-sh
  8. exit
  9. fi
  10. if [ "$1" = "--sh" ]; then
  11. sh=1
  12. shift
  13. elif [ "$1" = "--no-sh" ]; then
  14. nosh=1
  15. shift
  16. fi
  17. shopt -s nullglob
  18. { for path in ${PATH//:/$'\n'}; do
  19. for command in "${path}/rbenv-"*; do
  20. command="${command##*rbenv-}"
  21. if [ -n "$sh" ]; then
  22. if [ ${command:0:3} = "sh-" ]; then
  23. echo ${command##sh-}
  24. fi
  25. elif [ -n "$nosh" ]; then
  26. if [ ${command:0:3} != "sh-" ]; then
  27. echo ${command##sh-}
  28. fi
  29. else
  30. echo ${command##sh-}
  31. fi
  32. done
  33. done
  34. } | sort | uniq