aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2016-04-27 16:57:52 -0700
committerKenny Root <kroot@google.com>2016-04-27 16:57:53 -0700
commit77cab358b1dc292575b4dfbba0537ffcf6de82f4 (patch)
tree31d756de4e636cca46d2de870e0b3aef100052f1
parent317031cb0035803f54c21cc78ea7cf830a247865 (diff)
downloadplatform_sdk-77cab358b1dc292575b4dfbba0537ffcf6de82f4.tar.gz
platform_sdk-77cab358b1dc292575b4dfbba0537ffcf6de82f4.tar.bz2
platform_sdk-77cab358b1dc292575b4dfbba0537ffcf6de82f4.zip
adb completion: call _init_completion if available
If there was a shell redirection in the command line, you need to have some logic to handle it. Luckily bash-completion packages on most distributions have that logic already. Call it if it's available. Change-Id: I481cb4bf9e34ce46159378252a5c9a5c4934a11b
-rw-r--r--bash_completion/adb.bash9
1 files changed, 5 insertions, 4 deletions
diff --git a/bash_completion/adb.bash b/bash_completion/adb.bash
index 4b10e14fc..3017bfa2e 100644
--- a/bash_completion/adb.bash
+++ b/bash_completion/adb.bash
@@ -16,13 +16,14 @@
#
_adb() {
- unset -v have
- type $1 &> /dev/null && have="yes"
-
- if [ "$have" != "yes" ]; then
+ if ! type -t "$1" >/dev/null; then
return
fi
+ if type -t _init_completion >/dev/null; then
+ _init_completion || return
+ fi
+
local where i cur serial
COMPREPLY=()