From 045373edcdc66feeb8c2cc45d3431a03852c072d Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Tue, 28 May 2019 07:32:11 +0200 Subject: [PATCH] Added option to postpone an update --- bin/update | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/bin/update b/bin/update index 2d99fb1..067f5a7 100755 --- a/bin/update +++ b/bin/update @@ -263,6 +263,15 @@ update-neovim() { echo -e "\033[32;1m=== Neovim updated in $formatted ===\033[0m" } +update-postpone() { + local format=`_date_format` + + if [ $? -eq 0 ]; then + _check_date_file + date $format > ~/.config/dotfiles/.data/update_date + fi +} + _print_help() { echo } @@ -276,6 +285,7 @@ partial-test() { "neovim") return 0;; "check") return 0;; "startup") return 0;; + "postpone") return 0;; *) return 1;; esac } @@ -289,6 +299,7 @@ partial-update() { "neovim") update-neovim;; "check") _check_date_if_format force;; "startup") _check_date_if_format;; + "postpone") update-postpone;; *) return 1 esac } @@ -315,12 +326,7 @@ main() { # Update the neovim packages update-neovim - format=`_date_format` - - if [ $? -eq 0 ]; then - _check_date_file - date $format > ~/.config/dotfiles/.data/update_date - fi + update-postpone seconds=$((`date +%s` - $start )) formatted=`date -ud "@$seconds" +'%H hours %M minutes %S seconds'`