aboutsummaryrefslogtreecommitdiffhomepage
path: root/zsh
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2023-06-06 07:36:34 +0800
committerHsieh Chin Fan <pham@topo.tw>2023-06-06 07:36:34 +0800
commit74da533ad8e848d2ad3ea08acc1de6d193baeb12 (patch)
tree2c6aaf1a15f96e942cd9298ac71ff194ac1beca7 /zsh
parent4418f22aac80af84112ea7507480540e20c74385 (diff)
Update sync check
Diffstat (limited to 'zsh')
-rw-r--r--zsh/zshrc8
1 files changed, 4 insertions, 4 deletions
diff --git a/zsh/zshrc b/zsh/zshrc
index 1e31ecf..74b6b63 100644
--- a/zsh/zshrc
+++ b/zsh/zshrc
@@ -47,9 +47,9 @@ function _get_context() {
47 fi 47 fi
48} 48}
49 49
50function _sync_after_wakeup() { 50function _need_sync_after_wakeup() {
51 latest=$(date -d @`stat -c %Y ~/.wakeup` --iso-8601=minutes) 51 latest=$(date -d @`stat -c %Y ~/.wakeup` +%s)
52 test ! "$latest" = "$(cat ~/.wakeup)" 52 test "$latest" -ge "$(cat ~/.wakeup)"
53} 53}
54 54
55autoload -Uz add-zsh-hook 55autoload -Uz add-zsh-hook
@@ -71,7 +71,7 @@ function precmd() {
71 # Show context and git status of tracking repos at right 71 # Show context and git status of tracking repos at right
72 UNSYNC_REPOS=$(NUM=$($SETTING_DIR/bin/git/check-repos.sh -n); (( $NUM != 0 )) && echo $NUM) 72 UNSYNC_REPOS=$(NUM=$($SETTING_DIR/bin/git/check-repos.sh -n); (( $NUM != 0 )) && echo $NUM)
73 _get_context 73 _get_context
74 NEED_SYNC=$(_sync_after_wakeup || echo S) 74 NEED_SYNC=$(_need_sync_after_wakeup || echo S)
75 RPROMPT="%B%K{blue}%F{yellow}${CONTEXT:+ $CONTEXT }%f%k%K{red}%F{black}${UNSYNC_REPOS}${NEED_SYNC}%f%k%b" 75 RPROMPT="%B%K{blue}%F{yellow}${CONTEXT:+ $CONTEXT }%f%k%K{red}%F{black}${UNSYNC_REPOS}${NEED_SYNC}%f%k%b"
76 76
77 77