Commit 2ecf168f authored by Gaëtan Lehmann's avatar Gaëtan Lehmann Committed by Brad King

bash-completion: Avoid using _init_completion when not defined

With the current version of homebrew one gets:

   bash: _init_completion: command not found

Avoid this by initializing manually when the function is not defined.
parent 5a5ef001
......@@ -3,7 +3,14 @@
_cmake()
{
local cur prev words cword split=false
_init_completion -n := || return
if type -t _init_completion >/dev/null; then
_init_completion -n = || return
else
# manual initialization for older bash completion versions
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
fi
# Workaround for options like -DCMAKE_BUILD_TYPE=Release
local prefix=
......
......@@ -3,7 +3,14 @@
_cpack()
{
local cur prev words cword
_init_completion -n = || return
if type -t _init_completion >/dev/null; then
_init_completion -n = || return
else
# manual initialization for older bash completion versions
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
fi
case "$prev" in
-G)
......
......@@ -3,7 +3,14 @@
_ctest()
{
local cur prev words cword
_init_completion -n = || return
if type -t _init_completion >/dev/null; then
_init_completion -n = || return
else
# manual initialization for older bash completion versions
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
fi
case "$prev" in
-C|--build-config)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment