diff --git a/.gitignore b/.gitignore index 886e38d..c15d08c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ zsh/extraconfig.zsh - +zsh/env.zsh .data diff --git a/zsh/update.zsh b/zsh/update.zsh index e67ed45..c69b793 100644 --- a/zsh/update.zsh +++ b/zsh/update.zsh @@ -1,3 +1,13 @@ +_date_format() { + + case $UPDATE_CHECK in + "daily") echo +%d/%m/%Y;; + "weekly") echo +%V/%Y;; + "monthly") echo +%m/%Y;; + esac + +} + _check_date_file() { mkdir -p ~/.config/dotfiles/.data touch ~/.config/dotfiles/.data/update_date @@ -32,14 +42,15 @@ _sentence() { } _check_date() { + _check_date_file old_date=`cat ~/.config/dotfiles/.data/update_date` - new_date=`date +%d/%m/%y` + new_date=`date $1` if [ "$new_date" != "$old_date" ]; then _sentence not_updated - else + elif [ "$UPDATE_CHECK_ALWAYS" == "true" ]; then _sentence updated fi } @@ -207,6 +218,19 @@ update() { formatted=`date -ud "@$seconds" +'%H hours %M minutes %S seconds'` echo "\033[32;1m=== Update finished in $formatted ===\033[0m" - _check_date_file - date +%d/%m/%y > ~/.config/dotfiles/.data/update_date + format=`_date_format` + + if [ $? -eq 0 ]; then + _check_date_file + date $format > ~/.config/dotfiles/.data/update_date + fi +} + +# Spawn anonymous function +function() { + local format=`_date_format` + + if [ "$format" != "" ]; then + _check_date $format + fi } diff --git a/zshrc b/zshrc index 4b048d8..ed9cdca 100644 --- a/zshrc +++ b/zshrc @@ -10,6 +10,10 @@ ZSH_CUSTOM=$HOME/.config/dotfiles/zsh/oh-my-zsh ZSH_THEME="laptop" +if [ -f $DOTFILES/zsh/env.zsh ]; then + source $DOTFILES/zsh/env.zsh +fi + source $DOTFILES/zsh/config.zsh source $DOTFILES/zsh/path.zsh source $DOTFILES/zsh/exports.zsh