diff options
author | ho.namkoong <ho.namkoong@samsung.com> | 2014-01-16 17:56:01 +0900 |
---|---|---|
committer | ho.namkoong <ho.namkoong@samsung.com> | 2014-01-16 17:56:01 +0900 |
commit | f4f47a73a53e9cd65e6d33fbf4fd2dee559c19fd (patch) | |
tree | 8fbea5ce730165e33a598ea64c3df6263ef7a8b6 | |
parent | 908aff0ad17de2f6ed5226f6cff3bdf7428cb3ef (diff) | |
download | sdb-f4f47a73a53e9cd65e6d33fbf4fd2dee559c19fd.tar.gz sdb-f4f47a73a53e9cd65e6d33fbf4fd2dee559c19fd.tar.bz2 sdb-f4f47a73a53e9cd65e6d33fbf4fd2dee559c19fd.zip |
SDB: disable sdb autocomplete when sdb binary does not exist
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>
-rw-r--r-- | package/.sdb-completion.bash | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/package/.sdb-completion.bash b/package/.sdb-completion.bash index e98ad3d..d58fc0b 100644 --- a/package/.sdb-completion.bash +++ b/package/.sdb-completion.bash @@ -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}) |