From a2e91b76cde21cad4d160e3b078deda5b9b41af2 Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Fri, 28 Jul 2017 21:25:21 +0000 Subject: Merging r309112: ------------------------------------------------------------------------ r309112 | yamaguchi | 2017-07-26 06:30:36 -0700 (Wed, 26 Jul 2017) | 7 lines [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/branches/release_50@309435 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/bash-autocomplete.sh | 10 +++++++--- 1 file 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= 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. -- cgit v1.2.3