]> granicus.if.org Git - clang/commitdiff
[Bash-autocompletion] Fix a bug that -foo=bar doesn't handled properly
authorYuka Takahashi <yukatkh@gmail.com>
Sat, 8 Jul 2017 17:34:02 +0000 (17:34 +0000)
committerYuka Takahashi <yukatkh@gmail.com>
Sat, 8 Jul 2017 17:34:02 +0000 (17:34 +0000)
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

utils/bash-autocomplete.sh

index c28dc86b130923c0924156c4a588ae4801f37c73..bab193c56b16ef3589f420d54fdf8538261f3b61 100644 (file)
@@ -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