ソースを参照

[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
Yuka Takahashi 8 年 前
コミット
ed22ecfce6
1 ファイル変更6 行追加0 行削除
  1. 6 0
      utils/bash-autocomplete.sh

+ 6 - 0
utils/bash-autocomplete.sh

@@ -34,12 +34,18 @@ _clang()
   elif [[ "$w1" == -*  && "$cur" == '=' ]]; then
   elif [[ "$w1" == -*  && "$cur" == '=' ]]; then
     # -foo=<tab>
     # -foo=<tab>
     arg="$w1=,"
     arg="$w1=,"
+  elif [[ "$cur" == -*= ]]; then
+    # -foo=<tab>
+    arg="$cur,"
   elif [[ "$w1" == -* ]]; then
   elif [[ "$w1" == -* ]]; then
     # -foo <tab> or -foo bar<tab>
     # -foo <tab> or -foo bar<tab>
     arg="$w1,$cur"
     arg="$w1,$cur"
   elif [[ "$w2" == -* && "$w1" == '=' ]]; then
   elif [[ "$w2" == -* && "$w1" == '=' ]]; then
     # -foo=bar<tab>
     # -foo=bar<tab>
     arg="$w2=,$cur"
     arg="$w2=,$cur"
+  elif [[ ${cur: -1} != '=' && ${cur/=} != $cur ]]; then
+    # -foo=bar<tab>
+    arg="${cur%=*}=,${cur#*=}"
   fi
   fi
 
 
   # expand ~ to $HOME
   # expand ~ to $HOME