OSDN Git Service

Add bash completion to envsetup
authorKenny Root <kroot@google.com>
Fri, 15 Jul 2011 18:07:06 +0000 (11:07 -0700)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 3 Aug 2011 04:50:34 +0000 (12:50 +0800)
Change-Id: I0b4d74e72deede42d7e5f229593d79417f16bb55

envsetup.sh

index 48ddac9..a6f93bb 100644 (file)
@@ -184,6 +184,29 @@ function settitle()
     fi
 }
 
+function addcompletions()
+{
+    local T dir f
+
+    # Keep us from trying to run in something that isn't bash.
+    if [ -z "${BASH_VERSION}" ]; then
+        return
+    fi
+
+    # Keep us from trying to run in bash that's too old.
+    if [ ${BASH_VERSINFO[0]} -lt 3 ]; then
+        return
+    fi
+
+    dir="sdk/bash_completion"
+    if [ -d ${dir} ]; then
+        for f in ${dir}/[a-z]*; do
+            echo "including $f"
+            . $f
+        done
+    fi
+}
+
 case `uname -s` in
     Linux)
         function choosesim()
@@ -1105,3 +1128,5 @@ do
     . $f
 done
 unset f
+
+addcompletions