SDB: disable sdb autocomplete when sdb binary does not exist 18/15118/1
authorho.namkoong <ho.namkoong@samsung.com>
Thu, 16 Jan 2014 08:56:01 +0000 (17:56 +0900)
committerho.namkoong <ho.namkoong@samsung.com>
Thu, 16 Jan 2014 08:56:01 +0000 (17:56 +0900)
If sdb does not exists in the path that user inputs, autocomplete for sdb is disasbled

Change-Id: I6828156ccda6d9d0d4653cb7b2d3a515ed850b26
Signed-off-by: ho.namkoong <ho.namkoong@samsung.com>
package/.sdb-completion.bash

index e98ad3d593eadb87f8803c8efe30139f29e70059..d58fc0b3e63bac535a3531291de64d3491dea64c 100644 (file)
@@ -2,6 +2,14 @@ _sdb()
 {
     #sdb path is defined in PATH environment variable
     COMPREPLY=()
+
+    SDB_PATH=$(eval eval echo \$\{COMP_WORDS\[0\]\})
+
+    if [ ! -f ${SDB_PATH} ];
+    then
+        return 0;
+    fi
+
 #    cur="${COMP_WORDS[COMP_CWORD]}"
     ARGS="autocomplete,${COMP_CWORD}"
 
@@ -19,8 +27,6 @@ _sdb()
         ARGS="${ARGS}${IFS}${convertedarg}"
     done
 
-    SDB_PATH=$(eval eval echo \$\{COMP_WORDS\[0\]\})
-
     next=($("${SDB_PATH}" ${ARGS}))
     local IFS=$'\n'
     COMPREPLY=(${next})