~ubuntu-branches/ubuntu/wily/rbenv/wily

« back to all changes in this revision

Viewing changes to libexec/rbenv-commands

  • Committer: Package Import Robot
  • Author(s): Antonio Terceiro
  • Date: 2011-09-24 12:27:44 UTC
  • Revision ID: package-import@ubuntu.com-20110924122744-gpszt0huloxxzu6f
Tags: upstream-0.1.2+git20100922
ImportĀ upstreamĀ versionĀ 0.1.2+git20100922

Show diffs side-by-side

added added

removed removed

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