-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.shell-motd
59 lines (54 loc) · 1.09 KB
/
.shell-motd
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
# This file is called right before user prompt is available.
system_info() {
hostname
_isMacOS && (
echo "$(sw_vers -productName) $(sw_vers -productVersion) $(sw_vers -buildVersion)"
)
_isLinux && (
lsb_release --short --description
)
}
zpool_status() {
_hasCmd zpool && (
zpool status && echo
)
}
docker_running() {
_hasCmd docker && (
docker ps --format "table {{.Image}}\t{{.Status}}\t{{.Ports}}" 2> /dev/null | tail -n +2 && echo
)
}
repair_macos_make() {
# Updates on macOS might require reinstallation of developer tools
_hasCmd make || (
_isMacOS && xcode-select --install
)
}
dotfiles_status() {
_hasCmd .f && (
echo "dotfiles @ $(.f log --oneline | head -n 1)"
echo -n -e "\033[31m"
.f status --porcelain
.fp status --porcelain
echo -n -e "\033[0m"
)
}
resume_screen() {
# Try to resume screen session
_hasCmd screen && (
if [ $TERM != 'screen' ]; then
TERM="xterm" screen -r > /dev/null
fi
)
}
auto_make() {
make -f .auto.Makefile
}
if [ "$PWD" = "$HOME" ]; then
system_info
repair_macos_make
zpool_status
dotfiles_status
auto_make
fi
resume_screen