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

Rui Ueyama via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 1 05:17:30 PDT 2017


ruiu added inline comments.


================
Comment at: clang/utils/bash-autocomplete.sh:3
+
+_clang_filedir()
+{
----------------
Is the output of `compgen -f` the same as `_filedir`? If so, can you always use `compgen -f`?


================
Comment at: clang/utils/bash-autocomplete.sh:7
+  if [[ "$?" != 0 ]]; then
+    COMPREPLY=( $( compgen -f) )
+  fi
----------------
Let's be consistent on spacing. Please add a space after `-f`.


================
Comment at: clang/utils/bash-autocomplete.sh:15
+  # Require bash-completion with _init_completion
+  _init_completion -n 2>/dev/null
+  if [[ "$?" != 0 ]]; then
----------------
Likewise, add a space after `2>`.


================
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" ) )
----------------
Is it okay to use compopt here? (I wonder how does this line work on macOS.)


https://reviews.llvm.org/D34924





More information about the cfe-commits mailing list