diff options
author | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2019-02-15 05:12:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2019-02-18 07:24:49 +0000 |
commit | c46e6f868149e04378f379655341f3098f493c68 (patch) | |
tree | 5a96a0f7fc66e02fdf2fb44b7ea305c684addc02 /share/bash-completion | |
parent | Adding missing convenience symlinks in bash-completion. (diff) | |
download | compute-tools-c46e6f868149e04378f379655341f3098f493c68.tar.xz compute-tools-c46e6f868149e04378f379655341f3098f493c68.zip |
Adding container log command.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to '')
-rw-r--r-- | share/bash-completion/container | 37 |
1 files changed, 37 insertions, 0 deletions
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) |