summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-02-06 17:05:34 +0100
committerLudovic Courtès <ludo@gnu.org>2017-02-07 00:08:10 +0100
commita93c1c59218aac49382c35fe23d1e0f021e6e676 (patch)
tree897c68ac3efc66ab2ce5390c38911ffdedd1837c
parente109ed3922f2a3ff68a77f727ead27f2eb4a82ab (diff)
bash completion: Properly complete 'guix container exec'.
* etc/completion/bash/guix (_guix_complete_pid): New function. (_guix_complete): Add case for "container".
-rw-r--r--etc/completion/bash/guix13
1 files changed, 13 insertions, 0 deletions
diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix
index 9c851e3717..00c3dfaf49 100644
--- a/etc/completion/bash/guix
+++ b/etc/completion/bash/guix
@@ -113,6 +113,12 @@ _guix_complete_file ()
COMPREPLY=()
}
+_guix_complete_pid ()
+{
+ local pids="$(cd /proc; echo [0-9]*)"
+ COMPREPLY=($(compgen -W "$pids" -- "$1"))
+}
+
declare _guix_subcommands
_guix_complete ()
@@ -158,6 +164,13 @@ _guix_complete ()
2) _guix_complete_subcommand;;
*) _guix_complete_file;; # TODO: restrict to *.scm
esac
+ elif _guix_is_command "container"
+ then
+ case $COMP_CWORD in
+ 2) _guix_complete_subcommand;;
+ 3) _guix_complete_pid "$word_at_point";;
+ *) _guix_complete_file;;
+ esac
elif _guix_is_command "import"
then
_guix_complete_subcommand