summaryrefslogtreecommitdiffstats
path: root/share/bash-completion/container
diff options
context:
space:
mode:
Diffstat (limited to 'share/bash-completion/container')
-rw-r--r--share/bash-completion/container114
1 files changed, 100 insertions, 14 deletions
diff --git a/share/bash-completion/container b/share/bash-completion/container
index 540f162..5b57193 100644
--- a/share/bash-completion/container
+++ b/share/bash-completion/container
@@ -1,6 +1,6 @@
-# bash-completion
-#
-# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Open Infrastructure: compute-tools
+
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -43,6 +43,28 @@ _container()
return 0
;;
+ build|b)
+ case "${prev}" in
+ -n|--name)
+ opts="$(cd /etc/compute-tools/debconf 2>/dev/null && ls *.cfg */*.cfg 2>/dev/null | sed -e 's|.*/||g' -e 's|.cfg$||g')"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+
+ -s|--script)
+ opts="$(cd /usr/share/compute-tools/build-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
+ ;;
+
+ *)
+ opts="-n --name -c --capability -d --drop-capability -s --script -v --verbose -b --bind --bind-ro"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+ esac
+ ;;
+
console)
case "${prev}" in
-n|--name)
@@ -59,7 +81,23 @@ _container()
esac
;;
- create|cr)
+ enter|run)
+ case "${prev}" in
+ -n|--name)
+ opts="$(container list -s -f shell)"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+
+ *)
+ opts="-n --name"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+ esac
+ ;;
+
+ get|g)
case "${prev}" in
-n|--name)
opts="$(cd /etc/compute-tools/debconf 2>/dev/null && ls *.cfg */*.cfg 2>/dev/null | sed -e 's|.*/||g' -e 's|.cfg$||g')"
@@ -68,7 +106,7 @@ _container()
;;
-s|--script)
- opts="$(cd /usr/share/compute-tools/scripts && find -maxdepth 1 -not -type d -and -not -name 'default' -and -not -name 'debconf' -and -not -name '*.d' -printf '%P\n' | sort)"
+ opts="$(cd /usr/share/compute-tools/get-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
;;
@@ -81,16 +119,16 @@ _container()
esac
;;
- enter)
+ info)
case "${prev}" in
-n|--name)
- opts="$(container list -s -f shell)"
+ opts="$(container list -t -f shell)"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
*)
- opts="-n --name"
+ opts="--status --os --ip"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
@@ -98,9 +136,25 @@ _container()
;;
key)
- opts="-a --add -l --list -r --remove"
- COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
- return 0
+ case "${prev}" in
+ -a|--add)
+ opts="$(cd /usr/share/compute-tools/keys 2>/dev/null && ls *.pub 2>/dev/null | sed -e 's|.*/||g' -e 's|.pub$||g')"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+
+ -r|--remove)
+ opts="$(gpg --homedir /etc/compute-tools/keys --list-keys | grep ^uid | sed -e 's|.*<||' -e 's|>||')"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+
+ *)
+ opts="-a --add -r --remove -l --list"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+ esac
;;
limit)
@@ -203,14 +257,30 @@ _container()
;;
*)
- opts="-n --name -f --force"
+ opts="-n --name -f --force -i --interactive -k --kill"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+ esac
+ ;;
+
+ rebuild|rb)
+ case "${prev}" in
+ -n|--name)
+ opts="$(container list -f shell)"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+
+ *)
+ opts="-n --name -f --force -v --verbose"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
esac
;;
- restart|rt)
+ restart|rs)
case "${prev}" in
-n|--name)
opts="$(container list -s -f shell)"
@@ -245,7 +315,7 @@ _container()
status|st)
case "${prev}" in
-n|--name)
- opts="$(container list -t -f shell)"
+ opts="$(container list -f shell)"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
@@ -280,6 +350,22 @@ _container()
return 0
;;
+ update|u)
+ case "${prev}" in
+ -n|--name)
+ opts="$(container list -s -f shell)"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+
+ *)
+ opts="-n --name -f --full-upgrade -r --autoremove -p --purge --y --yes"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+ esac
+ ;;
+
version|ver)
return 0
;;