summaryrefslogtreecommitdiffstats
path: root/clang/utils/bash-autocomplete.sh
diff options
context:
space:
mode:
authorYuka Takahashi <yukatkh@gmail.com>2017-06-26 00:35:36 +0000
committerYuka Takahashi <yukatkh@gmail.com>2017-06-26 00:35:36 +0000
commita4a87802ede969b1820fa87ba4874b7c450fc1b1 (patch)
treea7c3c534a9b9ce17dc1eefed426c4cb2cdd54be0 /clang/utils/bash-autocomplete.sh
parent4a000883c76b751e1edc1542337b6cf62a1f2996 (diff)
downloadbcm5719-llvm-a4a87802ede969b1820fa87ba4874b7c450fc1b1.tar.gz
bcm5719-llvm-a4a87802ede969b1820fa87ba4874b7c450fc1b1.zip
[bash-autocompletion] Delete space after flags which has '=' prefix
Summary: This is patch for bash completion for clang project. We don't need space when completing options like "-stdlib=". Differential Revision: https://reviews.llvm.org/D34594 llvm-svn: 306258
Diffstat (limited to 'clang/utils/bash-autocomplete.sh')
-rw-r--r--clang/utils/bash-autocomplete.sh9
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/utils/bash-autocomplete.sh b/clang/utils/bash-autocomplete.sh
index 3e9f65f10db..ba908bcc0bc 100644
--- a/clang/utils/bash-autocomplete.sh
+++ b/clang/utils/bash-autocomplete.sh
@@ -22,16 +22,17 @@ _clang()
elif [[ "$w2" == -* && "$w1" == '=' ]]; then
# -foo=bar<tab>
arg="$w2=,$cur"
- else
- _filedir
fi
local flags=$( clang --autocomplete="$arg" )
- if [[ "$cur" == "=" ]]; then
+ if [[ "$cur" == '=' ]]; then
COMPREPLY=( $( compgen -W "$flags" -- "") )
- elif [[ "$flags" == "" ]]; then
+ elif [[ "$flags" == "" || "$arg" == "" ]]; then
_filedir
else
+ # Bash automatically appends a space after '=' by default.
+ # Disable it so that it works nicely for options in the form of -foo=bar.
+ [[ "${flags: -1}" == '=' ]] && compopt -o nospace
COMPREPLY=( $( compgen -W "$flags" -- "$cur" ) )
fi
}
OpenPOWER on IntegriCloud