2024-10-30 14:09:07: merge [master:0a23b8ef0f729e838872fc7270b8fc7c52342cdd];

This commit is contained in:
txix committed 2024-10-30 14:09:07 +03:00
1 parent 74f3ea35cc
commit 09f3c76f20
4 files changed
+131 -82

No files matched your search

+19 -5
View File
@@ -2,17 +2,31 @@
: ${PROG:=$(basename ${BASH_SOURCE})}
# Macs have bash3 for which the bash-completion package doesn't include
# _init_completion. This is a minimal version of that function.
_cli_init_completion() {
COMPREPLY=()
_get_comp_words_by_ref "$@" cur prev words cword
}
_cli_bash_autocomplete() {
if [[ "${COMP_WORDS[0]}" != "source" ]]; then
local cur opts base
local cur opts base words
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
if [[ "$cur" == "-"* ]]; then
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} ${cur} --generate-bash-completion )
if declare -F _init_completion >/dev/null 2>&1; then
_init_completion -n "=:" || return
else
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion )
_cli_init_completion -n "=:" || return
fi
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
words=("${words[@]:0:$cword}")
if [[ "$cur" == "-"* ]]; then
requestComp="${words[*]} ${cur} --generate-bash-completion"
else
requestComp="${words[*]} --generate-bash-completion"
fi
opts=$(eval "${requestComp}" 2>/dev/null)
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
return 0
fi
}