Update bash-completion

This commit is contained in:
Julian Ospald 2020-04-26 23:32:13 +02:00
parent 1d623723a2
commit ed4ff15f96
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28

View File

@ -1,11 +1,14 @@
_ghcup()
{
local cur
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
if [[ ${#COMP_WORDS[*]} -le 2 ]]; then
COMPREPLY=($(compgen -W "$(ghcup --list-commands)" -- $cur))
fi
return 0
} &&
complete -F _ghcup ghcup
local CMDLINE
local IFS=$'\n'
CMDLINE=(--bash-completion-index $COMP_CWORD)
for arg in ${COMP_WORDS[@]}; do
CMDLINE=(${CMDLINE[@]} --bash-completion-word $arg)
done
COMPREPLY=( $(ghcup "${CMDLINE[@]}") )
}
complete -o filenames -F _ghcup ghcup