From 5b7b4ff27cf1a64acad45b553075cff2122af5e7 Mon Sep 17 00:00:00 2001 From: hanez Date: Wed, 10 Sep 2025 00:54:07 +0200 Subject: [PATCH] home.sh update. --- .zsh/functions.d/home.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.zsh/functions.d/home.sh b/.zsh/functions.d/home.sh index 90a99c09..33436a35 100644 --- a/.zsh/functions.d/home.sh +++ b/.zsh/functions.d/home.sh @@ -1,3 +1,13 @@ +function _home_date() { + os_name=$(uname) + if [ "$os_name" = "FreeBSD" ]; then + hdate=$(date -r $1) + else + hdate=$(date -d @$1) + fi + return $hdate +} + function _home_help() { echo "Available commands:" echo "" @@ -15,7 +25,7 @@ function home() { cd $OLDPWD ;; help) - _foo_help + _home_help ;; pull) cd ~ @@ -38,9 +48,9 @@ function home() { last_update=$(stat -c %Y .lastupdate) echo "Last configuration update: $last_update" current_date=$(date +%s) - echo "Current date: $current_date" + echo "Current date: _home_date $current_date" time_diff=$(($current_date-$last_update)) - echo "Time difference: $time_diff" + echo "Time difference: $time_diff seconds." if (( time_diff > 86400 )) || [ "$2" = "f" ]; then echo "Updating home configuration..." if git pull; then