[bash-autocompletion] Delete space after flags which has '=' prefix

Summary:
This is patch for bash completion for clang project.
We don't need space when completing options like "-stdlib=".

Differential Revision: https://reviews.llvm.org/D34594

llvm-svn: 306258
This commit is contained in:
Yuka Takahashi 2017-06-26 00:35:36 +00:00
parent 4a000883c7
commit a4a87802ed
1 changed files with 5 additions and 4 deletions

View File

@ -22,16 +22,17 @@ _clang()
elif [[ "$w2" == -* && "$w1" == '=' ]]; then
# -foo=bar<tab>
arg="$w2=,$cur"
else
_filedir
fi
local flags=$( clang --autocomplete="$arg" )
if [[ "$cur" == "=" ]]; then
if [[ "$cur" == '=' ]]; then
COMPREPLY=( $( compgen -W "$flags" -- "") )
elif [[ "$flags" == "" ]]; then
elif [[ "$flags" == "" || "$arg" == "" ]]; then
_filedir
else
# Bash automatically appends a space after '=' by default.
# Disable it so that it works nicely for options in the form of -foo=bar.
[[ "${flags: -1}" == '=' ]] && compopt -o nospace
COMPREPLY=( $( compgen -W "$flags" -- "$cur" ) )
fi
}