[PATCH] D34924: [Bash-autocompletion] Check if bash-completion is installed

Yuka Takahashi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 1 02:46:17 PDT 2017


yamaguchi created this revision.

Bash-autocompletion for clang depends on bash-completion system and abort `bash:
_init_completion: command not found` when it is not installed.

Changed to return silently if bash-completion is not installed.


https://reviews.llvm.org/D34924

Files:
  clang/utils/bash-autocomplete.sh


Index: clang/utils/bash-autocomplete.sh
===================================================================
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -2,6 +2,11 @@
 _clang()
 {
   local cur prev words cword arg flags
+  # Require bash-completion with _init_completion
+  _init_completion 2>/dev/null
+  if [[ "$?" != 0 ]]; then
+    return
+  fi
   _init_completion -n : || return
 
   # bash always separates '=' as a token even if there's no space before/after '='.


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


More information about the cfe-commits mailing list