-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost-commit
More file actions
36 lines (31 loc) · 759 Bytes
/
post-commit
File metadata and controls
36 lines (31 loc) · 759 Bytes
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
#!/bin/sh
GCA="\e[1mGit Audio\e[22m"
CONFIG="$HOME/.git-audio/config.sh"
if [ ! -f $CONFIG ]; then
printf "$GCA: configuration not found, please re-install.\n\n"
exit 1
fi
. $CONFIG
if [ ! -f $GIT_AUDIO ]; then
printf "$GCA: audio not found $GIT_AUDIO\n\n"
exit 1
fi
OS=$(uname)
case $OS in
Darwin)
afplay $GIT_AUDIO &
;;
Linux)
if command -v paplay >/dev/null 2>&1; then
paplay $GIT_AUDIO &
elif command -v ffplay >/dev/null 2>&1; then
ffplay -nodisp -autoexit -loglevel quiet $GIT_AUDIO &
elif command -v aplay >/dev/null 2>&1; then
aplay -q $GIT_AUDIO &
else
printf "$GCA: no supported audio player found.\n\n"
fi
;;
*)
printf "$GCA: unsupported operating system $OS\n\n"
esac