Skip to content

Commit a4a8780

Browse files
committedJun 26, 2017
[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
1 parent 4a00088 commit a4a8780

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
 

‎clang/utils/bash-autocomplete.sh

+5-4
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,17 @@ _clang()
2222
elif [[ "$w2" == -* && "$w1" == '=' ]]; then
2323
# -foo=bar<tab>
2424
arg="$w2=,$cur"
25-
else
26-
_filedir
2725
fi
2826

2927
local flags=$( clang --autocomplete="$arg" )
30-
if [[ "$cur" == "=" ]]; then
28+
if [[ "$cur" == '=' ]]; then
3129
COMPREPLY=( $( compgen -W "$flags" -- "") )
32-
elif [[ "$flags" == "" ]]; then
30+
elif [[ "$flags" == "" || "$arg" == "" ]]; then
3331
_filedir
3432
else
33+
# Bash automatically appends a space after '=' by default.
34+
# Disable it so that it works nicely for options in the form of -foo=bar.
35+
[[ "${flags: -1}" == '=' ]] && compopt -o nospace
3536
COMPREPLY=( $( compgen -W "$flags" -- "$cur" ) )
3637
fi
3738
}

0 commit comments

Comments
 (0)
Please sign in to comment.