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

Yuka Takahashi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 1 05:18:37 PDT 2017


yamaguchi created this revision.

`~/build/bin/clang -f[tab]` was executed without ~ expanded to $HOME, so changed this by expanding ~ to path using eval.


https://reviews.llvm.org/D34925

Files:
  clang/utils/bash-autocomplete.sh


Index: clang/utils/bash-autocomplete.sh
===================================================================
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -24,7 +24,9 @@
     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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34925.104991.patch
Type: text/x-patch
Size: 544 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170701/f8e0b2ac/attachment.bin>


More information about the cfe-commits mailing list