diff options
author | Yuka Takahashi <yukatkh@gmail.com> | 2017-07-26 13:30:36 +0000 |
---|---|---|
committer | Yuka Takahashi <yukatkh@gmail.com> | 2017-07-26 13:30:36 +0000 |
commit | 50fc19e4732a0370c1c046d6e95f5a02154a319b (patch) | |
tree | 4ca93a46244bef97b603138754436f4c52b56751 /utils | |
parent | c4f5f6916def820e248a43a87774032c5ce70dc3 (diff) |
[Bash-completion] Fixed a bug that file doesn't autocompleted after =
Summary:
File path wasn't autocompleted after `-fmodule-cache-path=[tab]`, so
fixed this bug by checking if $flags contains only a newline or not.
Differential Revision: https://reviews.llvm.org/D35763
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309112 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/bash-autocomplete.sh | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/utils/bash-autocomplete.sh b/utils/bash-autocomplete.sh index 72531b99e3..83c168bf76 100644 --- a/utils/bash-autocomplete.sh +++ b/utils/bash-autocomplete.sh @@ -65,10 +65,14 @@ _clang() return fi - if [[ "$cur" == '=' ]]; then - COMPREPLY=( $( compgen -W "$flags" -- "") ) - elif [[ "$flags" == "" || "$arg" == "" ]]; then + # When clang does not emit any possible autocompletion, or user pushed tab after " ", + # just autocomplete files. + if [[ "$flags" == "$(echo -e '\n')" || "$arg" == "" ]]; then + # If -foo=<tab> and there was no possible values, autocomplete files. + [[ "$cur" == '=' || "$cur" == -*= ]] && cur="" _clang_filedir + elif [[ "$cur" == '=' ]]; then + COMPREPLY=( $( compgen -W "$flags" -- "") ) else # Bash automatically appends a space after '=' by default. # Disable it so that it works nicely for options in the form of -foo=bar. |