From 3f22aebdbc514afcf7a3c9557f75632a8f44f8a8 Mon Sep 17 00:00:00 2001 From: Evan Pratten Date: Tue, 11 Oct 2022 16:36:39 -0400 Subject: [PATCH] Add desync warnings --- configs/nvim/init.vim | 3 +++ configs/zsh/info.sh | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/configs/nvim/init.vim b/configs/nvim/init.vim index 3edaf2d..1eba75c 100644 --- a/configs/nvim/init.vim +++ b/configs/nvim/init.vim @@ -20,6 +20,9 @@ vnoremap + " Force VIM to use system clipboard set clipboard=unnamedplus diff --git a/configs/zsh/info.sh b/configs/zsh/info.sh index 53076b8..8522ddd 100644 --- a/configs/zsh/info.sh +++ b/configs/zsh/info.sh @@ -1,2 +1,18 @@ echo "$fg[$HOST_COLOR]Platform:$reset_color $(uname -o) $(uname -r)" -echo "$fg[$HOST_COLOR]Uptime:$reset_color $(uptime -p)" \ No newline at end of file +echo "$fg[$HOST_COLOR]Uptime:$reset_color $(uptime -p)" + +# Determine if $EWCONFIG_ROOT contains uncommitted changes +if [ -d $EWCONFIG_ROOT/.git ]; then + if [ -n "$(git -C $EWCONFIG_ROOT status --porcelain)" ]; then + echo "$fg[red]ewconfig contains uncommitted changes$reset_color" + fi +fi + +# Determine if $EWCONFIG_ROOT is up-to-date with origin. Only do this if we have network connectivity. +if [ -d $EWCONFIG_ROOT/.git ]; then + if ping -c 1 -W 1 git.github.com &> /dev/null; then + if [ -n "$(git -C $EWCONFIG_ROOT fetch --dry-run 2>&1 | grep -v 'up to date')" ]; then + echo "$fg[yellow]ewconfig is not up-to-date with origin$reset_color" + fi + fi +fi \ No newline at end of file