summaryrefslogtreecommitdiffstats
path: root/share/bash-completion
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-02-17 17:40:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-02-23 16:29:28 +0000
commit13175dfc19dbac8d7024f3f5fb3d838a4bc7a0a1 (patch)
treea033edc5f91aa71f29e5f5688d56ac6f48c97d26 /share/bash-completion
parentAdding upstream version 20180825. (diff)
downloadopen-infrastructure-compute-tools-13175dfc19dbac8d7024f3f5fb3d838a4bc7a0a1.tar.xz
open-infrastructure-compute-tools-13175dfc19dbac8d7024f3f5fb3d838a4bc7a0a1.zip
Adding upstream version 20190222.upstream/20190222
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'share/bash-completion')
-rw-r--r--share/bash-completion/container54
1 files changed, 45 insertions, 9 deletions
diff --git a/share/bash-completion/container b/share/bash-completion/container
index e117d16..150ff71 100644
--- a/share/bash-completion/container
+++ b/share/bash-completion/container
@@ -1,8 +1,7 @@
# bash-completion
#
-# container-tools - Manage systemd-nspawn containers
# Copyright (C) 2016 Andreas Kreuzer <andreas.kreuzer@open-infrastructure.net>
-# Copyright (C) 2016-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2016-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -64,13 +63,13 @@ _container()
create)
case "${prev}" in
-n|--name)
- opts="$(cd /etc/container-tools/debconf 2>/dev/null && ls *.cfg */*.cfg 2>/dev/null | sed -e 's|.*/||g' -e 's|.cfg$||g')"
+ opts="$(cd /etc/open-infrastructure/container/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/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)"
+ opts="$(cd /usr/share/open-infrastructure/container/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
;;
@@ -124,7 +123,7 @@ _container()
list|ls)
case "${prev}" in
-h|--host)
- opts="true false $(hostname -f)"
+ opts="true false $(hostname -f 2> /dev/null || hostname)"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
@@ -143,6 +142,43 @@ _container()
esac
;;
+ log)
+ case "${prev}" in
+ -d|--date)
+ opts="$(if ls /var/log/open-infrastructure/container.log-*.gz > /dev/null 2>&1;
+ then \
+ zcat /var/log/open-infrastructure/container.log-*.gz | awk '{ print $1 }' | sort -u; \
+ fi; \
+ if [ -e /var/log/open-infrastructure/container.log ]; \
+ then \
+ awk '{ print $1 }' /var/log/open-infrastructure/container.log | sort -u; \
+ fi) \
+ today yesterday"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+
+ -n|--name)
+ opts="$(if ls /var/log/open-infrastructure/container.log-*.gz > /dev/null 2>&1;
+ then \
+ zgrep -E '(\-n|\-\-name) ' /var/log/open-infrastructure/container.log-*.gz | sed -e 's|.*-n ||' -e 's|.*--name ||' -e 's| .*$||' | sort -u; \
+ fi; \
+ if [ -e /var/log/open-infrastructure/container.log ]; \
+ then \
+ grep -E '(\-n|\-\-name) ' /var/log/open-infrastructure/container.log | sed -e 's|.*-n ||' -e 's|.*--name ||' -e 's| .*$||' | sort -u; \
+ fi)"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+
+ *)
+ opts="-d --date -n --name"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+ esac
+ ;;
+
move|mv)
case "${prev}" in
-o|--old)
@@ -191,7 +227,7 @@ _container()
esac
;;
- start)
+ start|s)
case "${prev}" in
-n|--name)
opts="$(container list -t -f shell)"
@@ -207,7 +243,7 @@ _container()
esac
;;
- status)
+ status|st)
case "${prev}" in
-n|--name)
opts="$(container list -t -f shell)"
@@ -223,7 +259,7 @@ _container()
esac
;;
- stop)
+ stop|t)
case "${prev}" in
-n|--name)
opts="$(container list -s -f shell)"
@@ -250,7 +286,7 @@ _container()
;;
*)
- local commands=$(cd /usr/lib/container-tools/container 2>/dev/null && find * -type f -print)
+ local commands=$(cd /usr/lib/open-infrastructure/container 2>/dev/null && find * -type f -print)
COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) )
return 0
;;