diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-02-23 15:36:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-02-23 16:30:59 +0000 |
commit | 93d59c3176876b0990b27375458cf6518459bb07 (patch) | |
tree | 85403b3d9ac7f9df4b91195124b342dee81ec640 /share/bash-completion/container | |
parent | Releasing debian version 20180825-3. (diff) | |
download | open-infrastructure-compute-tools-93d59c3176876b0990b27375458cf6518459bb07.tar.xz open-infrastructure-compute-tools-93d59c3176876b0990b27375458cf6518459bb07.zip |
Merging upstream version 20190222.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'share/bash-completion/container')
-rw-r--r-- | share/bash-completion/container | 54 |
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 ;; |