summaryrefslogtreecommitdiff
path: root/etc/completion/bash
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/completion/bash
parentee5e4779e21b6eaf3229ab4201e731d8dde7e4b2 (diff)
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/completion/bash')
-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 724d35b21f4..fcf94826399 100644
--- a/etc/completion/bash/guix
+++ b/etc/completion/bash/guix
@@ -171,6 +171,18 @@ _guix_complete_file ()
171 COMPREPLY=() 171 COMPREPLY=()
172} 172}
173 173
174_guix_complete_available_package_or_store_file ()
175{
176 _guix_complete_available_package "$@"
177
178 # The current _guix_complete_file implementation doesn't compose (append to
179 # COMPREPLY), so we suggest file names only if no package names matched.
180 if [[ -z "$COMPREPLY" ]]
181 then
182 _guix_complete_file # TODO: restrict to store files
183 fi
184}
185
174_guix_complete_pid () 186_guix_complete_pid ()
175{ 187{
176 local pids="$(cd /proc; echo [0-9]*)" 188 local pids="$(cd /proc; echo [0-9]*)"
@@ -251,7 +263,7 @@ _guix_complete ()
251 then 263 then
252 _guix_complete_file 264 _guix_complete_file
253 else 265 else
254 _guix_complete_available_package "$word_at_point" 266 _guix_complete_available_package_or_store_file "$word_at_point"
255 fi 267 fi
256 elif [[ "$command" = "environment" ]] 268 elif [[ "$command" = "environment" ]]
257 then 269 then