mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
bash-completion: Improve compatibility with old bash
It is not uncommon for packages to install cmake's bash-completion without depending on common bash-completion helper scripts. This commit improves compatibility in those scenarios.
This commit is contained in:
@@ -97,7 +97,7 @@ _cmake()
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if $is_old_completion; then
|
if $is_old_completion && type -t _split_longopt >/dev/null; then
|
||||||
_split_longopt && split=true
|
_split_longopt && split=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -252,6 +252,12 @@ _cmake()
|
|||||||
[[ $was_split ]] && return
|
[[ $was_split ]] && return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ! type -t _parse_help >/dev/null; then
|
||||||
|
_parse_help() {
|
||||||
|
"$@" | sed -e 's/^[ ]*\(-[-A-Za-z]*\).*$/\1/;t' -e d
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
# FIXME(#26100): `cmake --help` is missing some options and does not
|
# FIXME(#26100): `cmake --help` is missing some options and does not
|
||||||
# have any mode-specific options like `cmake --build`'s `--config`.
|
# have any mode-specific options like `cmake --build`'s `--config`.
|
||||||
@@ -260,7 +266,11 @@ _cmake()
|
|||||||
[[ $COMPREPLY ]] && return
|
[[ $COMPREPLY ]] && return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_filedir
|
if type -t _filedir >/dev/null; then
|
||||||
|
_filedir
|
||||||
|
else
|
||||||
|
COMPREPLY=( $(compgen -fd -- ${cur}) )
|
||||||
|
fi
|
||||||
} &&
|
} &&
|
||||||
complete -F _cmake cmake
|
complete -F _cmake cmake
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user