From 9ba94267a427d74036e86461bb5b4237266a9b28 Mon Sep 17 00:00:00 2001 From: hanez Date: Tue, 9 Sep 2025 23:30:15 +0200 Subject: [PATCH] home up updated. --- .zsh/functions.d/home.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.zsh/functions.d/home.sh b/.zsh/functions.d/home.sh index 329cf7e0..a1279f93 100644 --- a/.zsh/functions.d/home.sh +++ b/.zsh/functions.d/home.sh @@ -30,8 +30,20 @@ function home() { ;; up) cd ~ - git pull - git submodule update --init --recursive + last_update=$(stat -c %Y .lastupdate) + current_date=$(date +%s) + time_diff=$(($current_date-$last_update)) + if (( time_diff > 86400 )); then + git pull + git submodule update --init --recursive + elif + echo "/home/hanez was already updated in the last 24 hours." + echo "Run this to force updating: home up f" + if [ "$2" = "x" ]; then + git pull + git submodule update --init --recursive + fi + fi ;; *) echo "command not found!"