[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/05: bash completion: Restore completion for 'guix system', etc.
From: |
guix-commits |
Subject: |
04/05: bash completion: Restore completion for 'guix system', etc. |
Date: |
Thu, 10 Sep 2020 06:30:05 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 2ba81afcc204024255ce548e2c4cc4aed5541093
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Thu Sep 10 11:19:41 2020 +0200
bash completion: Restore completion for 'guix system', etc.
Commit 538ca8dd65f0075cc65bcca18ed87f66a789290a introduced a second
'_guix_complete_subcommand' function, shadowing the existing one, which
broke sub-command completion for 'guix system', 'guix import', etc.
* etc/completion/bash/guix: Distinguish between '_guix_complete_command'
and '_guix_complete_subcommand'. Adjust users to call the right one.
---
etc/completion/bash/guix | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix
index 5aebd07..98d2048 100644
--- a/etc/completion/bash/guix
+++ b/etc/completion/bash/guix
@@ -19,6 +19,19 @@
# Bash completion for Guix commands.
declare _guix_available_packages
+declare _guix_commands
+
+_guix_complete_command ()
+{
+ local word_at_point="${COMP_WORDS[$COMP_CWORD]}"
+ 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-)"
+ fi
+ COMPREPLY=($(compgen -W "$_guix_commands" -- "$word_at_point"))
+}
_guix_complete_subcommand ()
{
@@ -146,19 +159,6 @@ _guix_complete_pid ()
COMPREPLY=($(compgen -W "$pids" -- "$1"))
}
-declare _guix_subcommands
-
-_guix_complete_subcommand ()
-{
- if [ -z "$_guix_subcommands" ]
- then
- # Cache the list of subcommands to speed things up.
- _guix_subcommands="$(guix --help 2> /dev/null \
- | grep '^ ' | cut -c 2-)"
- fi
- COMPREPLY=($(compgen -W "$_guix_subcommands" -- "$word_at_point"))
-}
-
_guix_complete ()
{
local word_count=${#COMP_WORDS[*]}
@@ -176,7 +176,7 @@ _guix_complete ()
case $COMP_CWORD in
1)
- _guix_complete_subcommand
+ _guix_complete_command
;;
*)
if _guix_is_command "package"
@@ -251,7 +251,7 @@ _guix_complete ()
then
_guix_complete_file
else
- _guix_complete_subcommand
+ _guix_complete_command
fi
elif _guix_is_command "container"
then
- branch master updated (2c229f1 -> de3a8ec), guix-commits, 2020/09/10
- 01/05: gnu: gcc-toolchain: Make "gcc" a "deprecated" alias for "gcc-toolchain"., guix-commits, 2020/09/10
- 03/05: scripts: Use 'define-command' and have 'guix help' use that., guix-commits, 2020/09/10
- 02/05: ui: '--help' output links to <https://guix.gnu.org/help/>., guix-commits, 2020/09/10
- 04/05: bash completion: Restore completion for 'guix system', etc.,
guix-commits <=
- 05/05: gnu: Add python-hg-evolve., guix-commits, 2020/09/10