bash completion: Adjust to new 'guix help' output.

This is a followup to 3794ce93be, which
broke command completion.

Reported by Oleg Pykhalov <go.wigust@gmail.com>.

* etc/completion/bash/guix (_guix_complete_command): Update to match
output of 'guix help' as introduced in
3794ce93be.
This commit is contained in:
Ludovic Courtès 2020-09-24 16:26:34 +02:00
parent 215b49a881
commit 8e0c5033b1
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

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