From c46e6f868149e04378f379655341f3098f493c68 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 15 Feb 2019 06:12:31 +0100 Subject: Adding container log command. Signed-off-by: Daniel Baumann --- share/bash-completion/container | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'share/bash-completion') diff --git a/share/bash-completion/container b/share/bash-completion/container index 4289961..3f1f271 100644 --- a/share/bash-completion/container +++ b/share/bash-completion/container @@ -143,6 +143,43 @@ _container() esac ;; + log) + case "${prev}" in + -d|--date) + opts="$(if ls /var/log/container-tools/container.log-*.gz > /dev/null 2>&1; + then \ + zcat /var/log/container-tools/container.log-*.gz | awk '{ print $1 }' | sort -u; \ + fi; \ + if [ -e /var/log/container-tools/container.log ]; \ + then \ + awk '{ print $1 }' /var/log/container-tools/container.log | sort -u; \ + fi) \ + today yesterday" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + + -n|--name) + opts="$(if ls /var/log/container-tools/container.log-*.gz > /dev/null 2>&1; + then \ + zgrep -E '(\-n|\-\-name) ' /var/log/container-tools/container.log-*.gz | sed -e 's|.*-n ||' -e 's|.*--name ||' -e 's| .*$||' | sort -u; \ + fi; \ + if [ -e /var/log/container-tools/container.log ]; \ + then \ + grep -E '(\-n|\-\-name) ' /var/log/container-tools/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) -- cgit v1.2.3