r307478 - [Bash-autocompletion] Fix a bug that -foo=bar doesn't handled properly

Yuka Takahashi via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 8 10:34:02 PDT 2017


Author: yamaguchi
Date: Sat Jul  8 10:34:02 2017
New Revision: 307478

URL: http://llvm.org/viewvc/llvm-project?rev=307478&view=rev
Log:
[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

Modified:
    cfe/trunk/utils/bash-autocomplete.sh

Modified: cfe/trunk/utils/bash-autocomplete.sh
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/bash-autocomplete.sh?rev=307478&r1=307477&r2=307478&view=diff
==============================================================================
--- cfe/trunk/utils/bash-autocomplete.sh (original)
+++ cfe/trunk/utils/bash-autocomplete.sh Sat Jul  8 10:34:02 2017
@@ -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




More information about the cfe-commits mailing list