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
1 changed files with 12 additions and 9 deletions

View File

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