diff options
author | Kyle Ladd <kyle@laddk.com> | 2013-09-11 20:43:42 -0400 |
---|---|---|
committer | Adnan Begovic <adnan@cyngn.com> | 2015-10-06 16:36:48 -0700 |
commit | 031a0b63382fd20de97647f5f4da8ed4e7b52dc0 (patch) | |
tree | da459ee90fee13bc9ddc7b87ceb2f6ecec47fa28 /envsetup.sh | |
parent | e1466d645d915923327696a7cdd660cfc9435fd0 (diff) | |
download | build-031a0b63382fd20de97647f5f4da8ed4e7b52dc0.zip build-031a0b63382fd20de97647f5f4da8ed4e7b52dc0.tar.gz build-031a0b63382fd20de97647f5f4da8ed4e7b52dc0.tar.bz2 |
build: fix bash completion sourcing
Sourcing functions in files from a function within a file being
sourced was giving bash a hard time. This fixes 'repo' command tab
completions.
Change-Id: Iac1b3078e20749fb474ed1270e0886cf435e24d9
Diffstat (limited to 'envsetup.sh')
-rw-r--r-- | envsetup.sh | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/envsetup.sh b/envsetup.sh index 8063143..0cda8cb 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -297,29 +297,19 @@ function settitle() fi } -function addcompletions() +function check_bash_version() { # Keep us from trying to run in something that isn't bash. if [ -z "${BASH_VERSION}" ]; then - return + return 1 fi # Keep us from trying to run in bash that's too old. if [ "${BASH_VERSINFO[0]}" -lt 4 ] ; then - return + return 2 fi - local T dir f - - dirs="sdk/bash_completion vendor/cm/bash_completion" - for dir in $dirs; do - if [ -d ${dir} ]; then - for f in `/bin/ls ${dir}/[a-z]*.bash 2> /dev/null`; do - echo "including $f" - . $f - done - fi - done + return 0 } function choosetype() @@ -2249,6 +2239,17 @@ do done unset f -addcompletions +# Add completions +check_bash_version && { + dirs="sdk/bash_completion vendor/cm/bash_completion" + for dir in $dirs; do + if [ -d ${dir} ]; then + for f in `/bin/ls ${dir}/[a-z]*.bash 2> /dev/null`; do + echo "including $f" + . $f + done + fi + done +} export ANDROID_BUILD_TOP=$(gettop) |