From: Yuka Takahashi Date: Sat, 8 Jul 2017 17:34:02 +0000 (+0000) Subject: [Bash-autocompletion] Fix a bug that -foo=bar doesn't handled properly X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ed22ecfce63e19e9f51b2a2305d37ec2d240fa3b;p=clang [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 --- diff --git a/utils/bash-autocomplete.sh b/utils/bash-autocomplete.sh index c28dc86b13..bab193c56b 100644 --- a/utils/bash-autocomplete.sh +++ b/utils/bash-autocomplete.sh @@ -34,12 +34,18 @@ _clang() elif [[ "$w1" == -* && "$cur" == '=' ]]; then # -foo= arg="$w1=," + elif [[ "$cur" == -*= ]]; then + # -foo= + arg="$cur," elif [[ "$w1" == -* ]]; then # -foo or -foo bar arg="$w1,$cur" elif [[ "$w2" == -* && "$w1" == '=' ]]; then # -foo=bar arg="$w2=,$cur" + elif [[ ${cur: -1} != '=' && ${cur/=} != $cur ]]; then + # -foo=bar + arg="${cur%=*}=,${cur#*=}" fi # expand ~ to $HOME