mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-17 07:11:52 +08:00
Auxiliary: bash-completion: use _comp_initialize
_init_completion has been deprecated upstream since 2.12. https://github.com/scop/bash-completion/blob/main/bash_completion.d/000_bash_completion_compat.bash#L237
This commit is contained in:
@@ -3,10 +3,14 @@
|
|||||||
_cmake()
|
_cmake()
|
||||||
{
|
{
|
||||||
local is_old_completion=false
|
local is_old_completion=false
|
||||||
|
local is_init_completion=false
|
||||||
|
|
||||||
local cur prev words cword split
|
local cur prev words cword split was_split
|
||||||
if type -t _init_completion >/dev/null; then
|
if type -t _comp_initialize >/dev/null; then
|
||||||
|
_comp_initialize -s || return
|
||||||
|
elif type -t _init_completion >/dev/null; then
|
||||||
_init_completion -s || return
|
_init_completion -s || return
|
||||||
|
is_init_completion=true
|
||||||
else
|
else
|
||||||
# manual initialization for older bash completion versions
|
# manual initialization for older bash completion versions
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
@@ -193,7 +197,11 @@ _cmake()
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
$split && return
|
if ($is_old_completion || $is_init_completion); then
|
||||||
|
$split && return
|
||||||
|
else
|
||||||
|
[[ $was_split ]] && return
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $(compgen -W '$( _parse_help "$1" --help )' -- ${cur}) )
|
COMPREPLY=( $(compgen -W '$( _parse_help "$1" --help )' -- ${cur}) )
|
||||||
|
Reference in New Issue
Block a user