From ed14bc298470f77f4ffacdc315ae87939f81c765 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sun, 3 Oct 2021 14:47:44 +0200 Subject: bash completion: Fix ‘system’ & ‘container’ subcommands. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * etc/completion/bash/guix (_guix_complete): Count words from the innermost command. --- etc/completion/bash/guix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'etc') 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" ]] -- cgit v1.2.3