This repository has been archived by the owner on Jun 30, 2022. It is now read-only.
generated from aubreypwd/zsh-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zsh-plugin-my-repos.plugin.zsh
71 lines (59 loc) · 2.01 KB
/
zsh-plugin-my-repos.plugin.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/zsh
###
# My Repos
#
# @since Tuesday, April 19, 2022
##
###
# A way to output a dirty message.
#
# @since Friday, August 27, 2021
##
function __dirty_message {
full="\e[31m⑂\e[0m \e[33m$1\e[0m is dirty"
tilde="~"
echo -e "${full/$HOME/$tilde}"
}
###
# Wrapper for git-is-clean messaging
#
# @since Friday, August 27, 2021
##
function __watchrepo {
git-is-clean "$1" || ( __dirty_message "$1" )
}
###
# Call this function to watch these repos.
#
# Not git pew is an alias in my .gitconfig
#
# E.g: checkmyrepos
#
# @since Wednesday, April 20, 2022
##
function checkmyrepos {
# Send updates upstream for these before we check them.
git --git-dir ~/Repos/github.com/aubreypwd/Alfred.alfredpreferences/.git pew &> /dev/null
git --git-dir ~/Repos/github.com/aubreypwd/iTerm2/.git pew &> /dev/null
# Watch these repositories for dirtiness.
__watchrepo "$HOME/iCloud/Profile Photos"
__watchrepo "$HOME/Repos/github.com/aubreypwd/Alfred.alfredpreferences"
__watchrepo "$HOME/Repos/github.com/aubreypwd/iTerm2"
__watchrepo "$HOME/Repos/github.com/aubreypwd/safari-user-scripts"
__watchrepo "$HOME/Repos/github.com/aubreypwd/subl-snippets"
# My ZSH plugins/configurations.
__watchrepo "$HOME/.antigen/bundles/aubreypwd/zsh-plugin-my-aliases"
__watchrepo "$HOME/.antigen/bundles/aubreypwd/zsh-plugin-my-functions"
__watchrepo "$HOME/.antigen/bundles/aubreypwd/zsh-plugin-my-mac-defaults"
__watchrepo "$HOME/.antigen/bundles/aubreypwd/zsh-plugin-my-opts"
__watchrepo "$HOME/.antigen/bundles/aubreypwd/zsh-plugin-my-repos"
__watchrepo "$HOME/.antigen/bundles/aubreypwd/zsh-plugin-my-require"
__watchrepo "$HOME/.antigen/bundles/aubreypwd/zsh-plugin-my-vars"
if [[ ! $( command -v vcsh ) ]]; then
echo "vcsh missing, please install so I can watch pub and priv!"
else
# Then check if we have anything else after that going on with vcsh.
vcsh pub diff-index --quiet --ignore-submodules HEAD || __dirty_message "pub"
vcsh priv diff-index --quiet --ignore-submodules HEAD || __dirty_message "priv"
fi
}