From 558f3dd527d3774bff70a53c5ab91a20c1f72b19 Mon Sep 17 00:00:00 2001 From: Yuka Takahashi Date: Sat, 1 Jul 2017 16:30:02 +0000 Subject: [PATCH] [Bash-completion] Fixed a bug that ~ doesn't expanded to $HOME Summary: `~/build/bin/clang -f[tab]` was executed without ~ expanded to $HOME, so changed this by expanding ~ to path using eval. Differential Revision: https://reviews.llvm.org/D34925 llvm-svn: 306957 --- clang/utils/bash-autocomplete.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/utils/bash-autocomplete.sh b/clang/utils/bash-autocomplete.sh index 775b1f45351a..4f9853accc88 100644 --- a/clang/utils/bash-autocomplete.sh +++ b/clang/utils/bash-autocomplete.sh @@ -24,7 +24,9 @@ _clang() arg="$w2=,$cur" fi - flags=$( "${COMP_WORDS[0]}" --autocomplete="$arg" 2>/dev/null ) + # expand ~ to $HOME + eval local path=${COMP_WORDS[0]} + flags=$( "$path" --autocomplete="$arg" 2>/dev/null ) # If clang is old that it does not support --autocomplete, # fall back to the filename completion. if [[ "$?" != 0 ]]; then