Print update feature

This commit is contained in:
Thomas Forgione 2019-12-06 11:01:04 +01:00
parent fd8039e275
commit 2a59351fe1
No known key found for this signature in database
GPG Key ID: 203DAEA747F48F41
1 changed files with 12 additions and 0 deletions

View File

@ -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() { _check_date_file() {
mkdir -p ~/.config/dotfiles/.data mkdir -p ~/.config/dotfiles/.data
touch ~/.config/dotfiles/.data/update_date 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[32mneovim\033[0m Updates the neovim packages"
echo -e " \033[32mcheck\033[0m Checks whether the system has been recently updated" 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[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[32mpostpone\033[0m Skip the current update (disable check warnings)"
echo -e " \033[32mforce-unlock\033[0m Deletes the lock file" echo -e " \033[32mforce-unlock\033[0m Deletes the lock file"
} }
@ -406,6 +415,7 @@ partial-test() {
"dotfiles") return 0;; "dotfiles") return 0;;
"neovim") return 0;; "neovim") return 0;;
"check") return 0;; "check") return 0;;
"last-update") return 0;;
"startup") return 0;; "startup") return 0;;
"postpone") return 0;; "postpone") return 0;;
"force-unlock") return 0;; "force-unlock") return 0;;
@ -422,6 +432,7 @@ partial-requires-lock() {
"dotfiles") return 0;; "dotfiles") return 0;;
"neovim") return 0;; "neovim") return 0;;
"check") return 1;; "check") return 1;;
"last-update") return 1;;
"startup") return 1;; "startup") return 1;;
"postpone") return 1;; "postpone") return 1;;
"force-unlock") return 1;; "force-unlock") return 1;;
@ -438,6 +449,7 @@ partial-update() {
"dotfiles") update-dotfiles;; "dotfiles") update-dotfiles;;
"neovim") update-neovim;; "neovim") update-neovim;;
"check") _check_date_if_format force;; "check") _check_date_if_format force;;
"last-update") _print_last_update;;
"startup") _check_date_if_format;; "startup") _check_date_if_format;;
"postpone") update-postpone;; "postpone") update-postpone;;
"force-unlock") _unlock;; "force-unlock") _unlock;;