summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorYuka Takahashi <yukatkh@gmail.com>2017-07-08 17:34:02 +0000
committerYuka Takahashi <yukatkh@gmail.com>2017-07-08 17:34:02 +0000
commited22ecfce63e19e9f51b2a2305d37ec2d240fa3b (patch)
tree19b90743b2214c782459f53c2005e6bc29bd9fc2 /utils
parent5a7460ecefe47bd10f16d1b239ed39b298d9f5d8 (diff)
[Bash-autocompletion] Fix a bug that -foo=bar doesn't handled properly
Summary: Fixed a bug that -foo=bar wasn't handled properly on old version of bash. Differential Revision: https://reviews.llvm.org/D34927 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307478 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/bash-autocomplete.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/utils/bash-autocomplete.sh b/utils/bash-autocomplete.sh
index c28dc86b13..bab193c56b 100644
--- a/utils/bash-autocomplete.sh
+++ b/utils/bash-autocomplete.sh
@@ -34,12 +34,18 @@ _clang()
elif [[ "$w1" == -* && "$cur" == '=' ]]; then
# -foo=<tab>
arg="$w1=,"
+ elif [[ "$cur" == -*= ]]; then
+ # -foo=<tab>
+ arg="$cur,"
elif [[ "$w1" == -* ]]; then
# -foo <tab> or -foo bar<tab>
arg="$w1,$cur"
elif [[ "$w2" == -* && "$w1" == '=' ]]; then
# -foo=bar<tab>
arg="$w2=,$cur"
+ elif [[ ${cur: -1} != '=' && ${cur/=} != $cur ]]; then
+ # -foo=bar<tab>
+ arg="${cur%=*}=,${cur#*=}"
fi
# expand ~ to $HOME