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


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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to