-
Notifications
You must be signed in to change notification settings - Fork 0
/
startup-check
executable file
·70 lines (58 loc) · 1.54 KB
/
startup-check
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
#!/usr/bin/env bash
# shellcheck disable=SC2164
GREEN='\033[0;32m';
YELLOW='\033[0;33m';
NC='\033[0m'
checkPath() {
local path=$1
cd "$path"
status=$(git -c color.ui=always pull 2>&1)
if ! (echo "$status" | grep -q 'Already up to date.'); then
echo -e "$YELLOW------------------------------"
pwd
echo -e "------------------------------$NC\n"
echo "$status"
echo
else
echo -e "${GREEN}✓$NC up to date: $(pwd | sed 's/\n//')"
fi
}
fail() {
echo "$1"
exit 1
}
containedIn () {
local e match="$1"
shift
for e; do [[ "$e" == "$match" ]] && return 0; done
return 1
}
if [ -f ~/.vcs-exclusions ]; then
source ~/.vcs-exclusions;
else
except=(
"laradock"
"laravel"
)
fi
for dir in ~/dev/*; do
if [ ! -d "$dir" ]; then continue; fi
if [ ! -d "$dir/.git" ]; then continue; fi
cd "$dir";
if (($(git remote -v | wc -l) == 0)); then continue; fi
if containedIn "$(basename "$dir")" "${except[@]}"; then continue; fi
checkPath "$dir"
done
checkPath ~/bin
[ -d ~/bin2 ] && checkPath ~/bin2
[ -d ~/dev/arduino/Mode100 ] && checkPath ~/dev/arduino/Model100
[ -d ~/.config/JetBrains ] && JETBRAINS_DIR=~/.config/JetBrains/ || JETBRAINS_DIR=~/Library/Application\ Support/JetBrains
if [ -d "$JETBRAINS_DIR" ]; then
cd "$JETBRAINS_DIR"
stormDir=$(ls -1d PhpStorm* | grep -v backup | tail -n 1)
roverDir=$(ls -1d RustRover* 2>/dev/null | grep -v backup | tail -n 1)
checkPath "$JETBRAINS_DIR/$stormDir/keymaps"
if [ -n "$roverDir" ]; then
checkPath "$JETBRAINS_DIR/$roverDir/keymaps"
fi
fi