[PATCH] D34924: [Bash-autocompletion] Add support for older bash version.

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


yamaguchi added inline comments.


================
Comment at: clang/utils/bash-autocomplete.sh:3
+
+_clang_filedir()
+{
----------------
ruiu wrote:
> Is the output of `compgen -f` the same as `_filedir`? If so, can you always use `compgen -f`?
_filedir is better than `compgen -f`, because it honors spaces in filenames.


================
Comment at: clang/utils/bash-autocomplete.sh:58
     # Disable it so that it works nicely for options in the form of -foo=bar.
-    [[ "${flags: -1}" == '=' ]] && compopt -o nospace
+    [[ "${flags: -1}" == '=' ]] && compopt -o nospace 2>/dev/null
     COMPREPLY=( $( compgen -W "$flags" -- "$cur" ) )
----------------
ruiu wrote:
> Is it okay to use compopt here? (I wonder how does this line work on macOS.)
I thought it will just emit errors and proceed to next line. This part doesn't make a big difference in completion, so I thought we can just ignore it when compopt is not supported.


https://reviews.llvm.org/D34924





More information about the cfe-commits mailing list