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

Yuka Takahashi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 1 12:05:40 PDT 2017


yamaguchi created this revision.

Fixed a bug that -foo=bar wasn't handled properly on old version of bash.


https://reviews.llvm.org/D34927

Files:
  clang/utils/bash-autocomplete.sh


Index: clang/utils/bash-autocomplete.sh
===================================================================
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -34,12 +34,18 @@
   elif [[ "$w1" == -*  && "$cur" == '=' ]]; then
     # -foo=<tab>
     arg="$w1=,"
+  elif [[ ${cur:0:1} == '-' && ${cur: -1} == '=' ]]; 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34927.105000.patch
Type: text/x-patch
Size: 700 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170701/509131c1/attachment.bin>


More information about the cfe-commits mailing list