r306957 - [Bash-completion] Fixed a bug that ~ doesn't expanded to $HOME

Yuka Takahashi via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 1 09:30:02 PDT 2017


Author: yamaguchi
Date: Sat Jul  1 09:30:02 2017
New Revision: 306957

URL: http://llvm.org/viewvc/llvm-project?rev=306957&view=rev
Log:
[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

Modified:
    cfe/trunk/utils/bash-autocomplete.sh

Modified: cfe/trunk/utils/bash-autocomplete.sh
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/bash-autocomplete.sh?rev=306957&r1=306956&r2=306957&view=diff
==============================================================================
--- cfe/trunk/utils/bash-autocomplete.sh (original)
+++ cfe/trunk/utils/bash-autocomplete.sh Sat Jul  1 09:30:02 2017
@@ -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




More information about the cfe-commits mailing list