From 2a59351fe196cc3cafd4652bc8be58c654dd0973 Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Fri, 6 Dec 2019 11:01:04 +0100 Subject: [PATCH] Print update feature --- bin/update | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bin/update b/bin/update index 695bda1..94f89ae 100755 --- a/bin/update +++ b/bin/update @@ -58,6 +58,14 @@ _date_format() { } +_print_last_update() { + if [ "$UPDATE_CHECK_TYPE" = "sliding" ]; then + date --date=@$(cat ~/.config/dotfiles/.data/update_date) +%x + else + echo -e >&2 "\033[31;1merror:\033[0m last-update only available for sliding update check" + fi +} + _check_date_file() { mkdir -p ~/.config/dotfiles/.data touch ~/.config/dotfiles/.data/update_date @@ -393,6 +401,7 @@ _print_usage() { echo -e " \033[32mneovim\033[0m Updates the neovim packages" echo -e " \033[32mcheck\033[0m Checks whether the system has been recently updated" echo -e " \033[32mstartup\033[0m Same as \`update check\` but is silent in case of success" + echo -e " \033[32mlast-update\033[0m Print the last update date" echo -e " \033[32mpostpone\033[0m Skip the current update (disable check warnings)" echo -e " \033[32mforce-unlock\033[0m Deletes the lock file" } @@ -406,6 +415,7 @@ partial-test() { "dotfiles") return 0;; "neovim") return 0;; "check") return 0;; + "last-update") return 0;; "startup") return 0;; "postpone") return 0;; "force-unlock") return 0;; @@ -422,6 +432,7 @@ partial-requires-lock() { "dotfiles") return 0;; "neovim") return 0;; "check") return 1;; + "last-update") return 1;; "startup") return 1;; "postpone") return 1;; "force-unlock") return 1;; @@ -438,6 +449,7 @@ partial-update() { "dotfiles") update-dotfiles;; "neovim") update-neovim;; "check") _check_date_if_format force;; + "last-update") _print_last_update;; "startup") _check_date_if_format;; "postpone") update-postpone;; "force-unlock") _unlock;;