[PATCH] D35763: [Bash-completion] Fixed a bug that file doesn't autocompleted after =

Yuka Takahashi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 26 06:32:09 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL309112: [Bash-completion] Fixed a bug that file doesn't autocompleted after = (authored by yamaguchi).

Changed prior to commit:
  https://reviews.llvm.org/D35763?vs=107787&id=108266#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D35763

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


Index: cfe/trunk/utils/bash-autocomplete.sh
===================================================================
--- cfe/trunk/utils/bash-autocomplete.sh
+++ cfe/trunk/utils/bash-autocomplete.sh
@@ -65,10 +65,14 @@
     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=<tab> 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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35763.108266.patch
Type: text/x-patch
Size: 930 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170726/3eb6518a/attachment.bin>


More information about the cfe-commits mailing list