bash completion: Complete subcommands for the current word.

* etc/completion/bash/guix (_guix_complete_subcommand): Refer to
the $COMP_CWORD element instead of the last element.
This commit is contained in:
Ludovic Courtès 2017-02-06 17:08:35 +01:00
parent a93c1c5921
commit f2c66fbe1f
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 1 additions and 1 deletions

View File

@ -26,7 +26,7 @@ _guix_complete_subcommand ()
local subcommands="$(${COMP_WORDS[0]} $command --help 2> /dev/null \
| grep '^ [a-z]' \
| sed -e's/^ \+\([a-z-]\+\).*$/\1/g')"
COMPREPLY=($(compgen -W "$subcommands" -- "${COMP_WORDS[${#COMP_WORDS[*]} - 1]}"))
COMPREPLY=($(compgen -W "$subcommands" -- "${COMP_WORDS[$COMP_CWORD]}"))
}
_guix_complete_available_package ()