diff options
author | Yuka Takahashi <yukatkh@gmail.com> | 2017-06-26 00:35:36 +0000 |
---|---|---|
committer | Yuka Takahashi <yukatkh@gmail.com> | 2017-06-26 00:35:36 +0000 |
commit | 908e5ec11c303467432993194bb8edbc97b22863 (patch) | |
tree | 5792803600afb805389bd141e74d4c63d8c0bed3 /utils | |
parent | 5ffe2de01efe7f79626ff84ba7fca95bbf80e0ab (diff) | |
download | clang-908e5ec11c303467432993194bb8edbc97b22863.tar.gz |
[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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306258 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/bash-autocomplete.sh | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/utils/bash-autocomplete.sh b/utils/bash-autocomplete.sh index 3e9f65f10d..ba908bcc0b 100644 --- a/utils/bash-autocomplete.sh +++ b/utils/bash-autocomplete.sh @@ -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 } |