Skip to content

Commit

Permalink
Update .zshrc
Browse files Browse the repository at this point in the history
  • Loading branch information
Allianaab2m committed Sep 11, 2024
1 parent 053d04e commit cae1621
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions dot_zshrc
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
function is_dirty() {
local dotfiles_dir=$(chezmoi source-path)
test -n "$(git -C ${dotfiles_dir} status --porcelain)" ||
! git -C ${dotfiles_dir} diff --exit-code --stat --cached origin/main > /dev/null
}

function warn_dirty() {
local dotfiles_dir=$(chezmoi source-path)
if is_dirty $? ; then
echo -e "\e[1;36m[[dotfiles]]\e[m"
echo -e "\e[1;33m[warn] DIRTY DOTFILES\e[m"
echo -e "\e[1;33m -> Push your local changes in $dotfiles_dir\e[m"
fi
}

if [[ ! -o login ]]; then
# Avoid duplicate warning (See .config/zsh/.zprofile)
warn_dirty
fi

eval "$(sheldon source)"

0 comments on commit cae1621

Please sign in to comment.