summaryrefslogtreecommitdiffstats
path: root/share/bash-completion
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2016-07-01 09:53:17 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2016-07-01 09:53:17 +0000
commita18674d73d1ef3472897c0f2049bf8131b9e4eb6 (patch)
tree0910f1df6e4648f6866cc06910314b845bf99bf1 /share/bash-completion
parentAdding upstream version 20160615. (diff)
downloadopen-infrastructure-compute-tools-a18674d73d1ef3472897c0f2049bf8131b9e4eb6.tar.xz
open-infrastructure-compute-tools-a18674d73d1ef3472897c0f2049bf8131b9e4eb6.zip
Adding upstream version 20160701.upstream/20160701
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'share/bash-completion')
-rw-r--r--share/bash-completion/container (renamed from share/bash-completion/container-tools)58
1 files changed, 53 insertions, 5 deletions
diff --git a/share/bash-completion/container-tools b/share/bash-completion/container
index 219fd2f..f6434f8 100644
--- a/share/bash-completion/container-tools
+++ b/share/bash-completion/container
@@ -1,4 +1,6 @@
-# Open Infrastructure: container-tools
+# bash-completion
+#
+# container-tools - Manage systemd-nspawn containers
# Copyright (C) 2016 Andreas Kreuzer <andreas.kreuzer@open-infrastructure.net>
#
# This program is free software: you can redistribute it and/or modify
@@ -71,7 +73,27 @@ _container()
;;
-s|--script)
- opts="debootstrap debconf default"
+ opts=$(cd /usr/share/container-tools/scripts && find -maxdepth 1 -not -type d -and -not -name 'default' -and -not -name 'debconf' -and -not -name '*.d' -printf '%P\n' | sort)
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ enter)
+ case "${cur}" in
+ -*)
+ opts="-n --name"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+
+ *)
+ case "${prev}" in
+ -n|--name)
+ opts=$(container list -s -f short)
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
@@ -103,7 +125,7 @@ _container()
list)
case "${cur}" in
-*)
- opts="-a --all -f --format -h --host -s --started -t --stopped"
+ opts="-a --all -f --format -h --host -o --other -s --started -t --stopped"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
@@ -115,6 +137,12 @@ _container()
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
+
+ -f|--format)
+ opts="short full"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
esac
;;
esac
@@ -131,7 +159,7 @@ _container()
*)
case "${prev}" in
-n|--name)
- opts=$(container list -a -f short)
+ opts=$(container list -t -f short)
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
@@ -180,6 +208,26 @@ _container()
esac
;;
+ status)
+ case "${cur}" in
+ -*)
+ opts="-n --name"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+
+ *)
+ case "${prev}" in
+ -n|--name)
+ opts=$(container list -t -f short)
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
stop)
case "${cur}" in
-*)
@@ -201,7 +249,7 @@ _container()
;;
*)
- local commands=$(ls /usr/lib/container-tools/container/)
+ local commands=$(cd /usr/lib/container-tools/container 2>/dev/null && ls)
COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) )
return 0
;;