From 8c000110cf3a858aa34bff1ea63f17daba4f41bb Mon Sep 17 00:00:00 2001 From: Yuka Takahashi Date: Wed, 26 Jul 2017 13:30:36 +0000 Subject: [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 llvm-svn: 309112 --- clang/utils/bash-autocomplete.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'clang/utils/bash-autocomplete.sh') diff --git a/clang/utils/bash-autocomplete.sh b/clang/utils/bash-autocomplete.sh index 72531b99e3d..83c168bf764 100644 --- a/clang/utils/bash-autocomplete.sh +++ b/clang/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