summary refs log tree commit diff
path: root/etc
diff options
context:
space:
mode:
authorTobias Geerinckx-Rice <me@tobias.gr>2021-10-03 14:47:44 +0200
committerTobias Geerinckx-Rice <me@tobias.gr>2021-10-03 19:23:49 +0200
commited14bc298470f77f4ffacdc315ae87939f81c765 (patch)
tree6eb872ca61b56b53ad6ab26935f969f15e86a85a /etc
parentd71cfaea3006bc02dc6d309d916809e1f799f04e (diff)
downloadguix-ed14bc298470f77f4ffacdc315ae87939f81c765.tar.gz
bash completion: Fix ‘system’ & ‘container’ subcommands.
* etc/completion/bash/guix (_guix_complete): Count words from the
innermost command.
Diffstat (limited to 'etc')
-rw-r--r--etc/completion/bash/guix10
1 files changed, 5 insertions, 5 deletions
diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix
index d5ec427e0c..87d9911e53 100644
--- a/etc/completion/bash/guix
+++ b/etc/completion/bash/guix
@@ -284,8 +284,8 @@ _guix_complete ()
 		_guix_complete_available_package_or_store_file "$word_at_point"
 	    elif [[ "$command" = "system" ]]
 	    then
-		case $COMP_CWORD in
-		    2) _guix_complete_subcommand;;
+		case $((COMP_CWORD - command_index)) in
+		    1) _guix_complete_subcommand;;
 		    *) _guix_complete_file;; # TODO: restrict to *.scm
 		esac
             elif [[ "$command" = "pull" ]]
@@ -304,9 +304,9 @@ _guix_complete ()
                 fi
 	    elif [[ "$command" = "container" ]]
 	    then
-		case $COMP_CWORD in
-		    2) _guix_complete_subcommand;;
-		    3) _guix_complete_pid "$word_at_point";;
+		case $((COMP_CWORD - command_index)) in
+		    1) _guix_complete_subcommand;;
+		    2) _guix_complete_pid "$word_at_point";;
 		    *) _guix_complete_file;;
 		esac
 	    elif [[ "$command" = "import" ]]