summary refs log tree commit diff
path: root/etc/completion/bash
diff options
context:
space:
mode:
authorTobias Geerinckx-Rice <me@tobias.gr>2021-10-03 13:15:56 +0200
committerTobias Geerinckx-Rice <me@tobias.gr>2021-10-03 19:23:48 +0200
commit6fba67df1928a62abc7939bd8ff020e998ad8d6b (patch)
treeeb6cd7dac1521cb7f32a5d32e8517d872b8b24db /etc/completion/bash
parent83128c97d44311c7ed715c92edad8474e727c048 (diff)
downloadguix-6fba67df1928a62abc7939bd8ff020e998ad8d6b.tar.gz
bash completion: Consolidate similar $command ‘if’ branches.
* etc/completion/bash/guix (_guix_complete): Combine the ‘upgrade’ and
‘remove’ commands, as well as ‘download’, ‘gc’, and ‘hash’.
Diffstat (limited to 'etc/completion/bash')
-rw-r--r--etc/completion/bash/guix17
1 files changed, 3 insertions, 14 deletions
diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix
index a9386e7794..112ea789de 100644
--- a/etc/completion/bash/guix
+++ b/etc/completion/bash/guix
@@ -237,15 +237,7 @@ _guix_complete ()
 		else
 		    _guix_complete_available_package "$word_at_point"
 		fi
-	    elif [[ "$command" = "remove" ]]
-	    then
-                if _guix_is_dash_L || _guix_is_dash_m || _guix_is_dash_p
-                then
-                    _guix_complete_file
-		else
-		    _guix_complete_installed_package "$word_at_point"
-		fi
-	    elif [[ "$command" = "upgrade" ]]
+	    elif [[ "$command" = "upgrade" || "$command" = "remove" ]]
 	    then
                 if _guix_is_dash_L || _guix_is_dash_m || _guix_is_dash_p
                 then
@@ -272,9 +264,9 @@ _guix_complete ()
 		else
 		    _guix_complete_available_package "$word_at_point"
 		fi
-	    elif [[ "$command" = "download" ]]
+	    elif [[ "$command" = "download" || "$command" = "gc" || "$command" = "hash" ]]
 	    then
-		 _guix_complete_file
+		_guix_complete_file
 	    elif [[ "$command" = "system" ]]
 	    then
 		case $COMP_CWORD in
@@ -305,9 +297,6 @@ _guix_complete ()
 	    elif [[ "$command" = "import" ]]
 	    then
 		_guix_complete_subcommand
-	    elif [[ "$command" = "hash" || "$command" = "gc" ]]
-	    then
-		_guix_complete_file
             elif [[ "$command" = "weather" ]]
             then
                 if _guix_is_dash_m