bash completion: Don't hard-code "guix" binary name.

* etc/completion/bash/guix (_guix_complete_command):
Use ${COMP_WORDS[0]} instead of hard-coding "guix".
This commit is contained in:
Tobias Geerinckx-Rice 2021-10-30 16:34:10 +02:00
parent 8f45555781
commit 0987a0eba4
No known key found for this signature in database
GPG Key ID: 0DB0FF884F556D79
1 changed files with 2 additions and 1 deletions

View File

@ -28,10 +28,11 @@ _guix_complete_command ()
if [ -z "$_guix_commands" ]
then
# Cache the list of commands to speed things up.
_guix_commands="$(guix --help 2> /dev/null \
_guix_commands="$(${COMP_WORDS[0]} --help 2> /dev/null \
| grep '^ ' \
| sed '-es/^ *\([a-z-]\+\).*$/\1/g')"
fi
COMPREPLY+=($(compgen -W "$_guix_commands" -- "$word_at_point"))
}