aboutsummaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorTobias Geerinckx-Rice <me@tobias.gr>2021-10-03 13:50:10 +0200
committerTobias Geerinckx-Rice <me@tobias.gr>2021-10-03 19:23:48 +0200
commit9e3355d2a35796276d17af13ac45814dbf6c4203 (patch)
treeede94c10c2d1a5f5200173638d932944f4da0e20 /etc
parentee5e4779e21b6eaf3229ab4201e731d8dde7e4b2 (diff)
downloadguix-9e3355d2a35796276d17af13ac45814dbf6c4203.tar
guix-9e3355d2a35796276d17af13ac45814dbf6c4203.tar.gz
bash completion: Complete ‘guix build’ file names.
* etc/completion/bash/guix (_guix_complete_available_package_or_store_file): New function. (_guix_complete): Call it in place of _guix_complete_available_package after the ‘build’ command.
Diffstat (limited to 'etc')
-rw-r--r--etc/completion/bash/guix14
1 files changed, 13 insertions, 1 deletions
diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix
index 724d35b21f..fcf9482639 100644
--- a/etc/completion/bash/guix
+++ b/etc/completion/bash/guix
@@ -171,6 +171,18 @@ _guix_complete_file ()
COMPREPLY=()
}
+_guix_complete_available_package_or_store_file ()
+{
+ _guix_complete_available_package "$@"
+
+ # The current _guix_complete_file implementation doesn't compose (append to
+ # COMPREPLY), so we suggest file names only if no package names matched.
+ if [[ -z "$COMPREPLY" ]]
+ then
+ _guix_complete_file # TODO: restrict to store files
+ fi
+}
+
_guix_complete_pid ()
{
local pids="$(cd /proc; echo [0-9]*)"
@@ -251,7 +263,7 @@ _guix_complete ()
then
_guix_complete_file
else
- _guix_complete_available_package "$word_at_point"
+ _guix_complete_available_package_or_store_file "$word_at_point"
fi
elif [[ "$command" = "environment" ]]
then