forked from codingMustache/zshMusic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshMusic.zsh
executable file
·126 lines (112 loc) · 2.95 KB
/
zshMusic.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/zsh
dir="$(dirname "${0:A}")/appleScripts"
music() {
if [[ -z $1 ]]; then
help
else
case $1 in
-open | -o)
osascript $dir/open.applescript
;;
-artist | -a)
if [[ -z $2 ]]; then
echo "You Need to pass an Artist"
else
osascript $dir/playArtist.applescript "$2"
fi
;;
-vol | -v)
if [[ -z $2 ]]; then
echo "This set volume 0-100"
else
osascript $dir/volume.applescript "$2"
fi
;;
-stop | -s)
osascript $dir/pause.applescript "$2"
;;
-play | -p)
osascript $dir/play.applescript "$2"
;;
-next | -n)
osascript $dir/next.applescript "$2"
;;
-current | -c)
osascript $dir/current.applescript "$2"
;;
-help | -h)
help
;;
*)
help
echo "Invalid option flag."
;;
esac
fi
}
help(){
# Define table headers
header1="COMMAND"
header2="CMD"
header3="DESCRIPTION"
header4="USAGE"
# Print table rows
com1="-open"
cmd1="-o"
des1="Launches Music"
ex1="music -o"
com2="-vol"
cmd2="-v"
des2="Changes volume"
ex2="music -v 10"
com3="-artist"
cmd3="-a"
des3="Plays artist from lib"
ex3="music -a metallica"
com4="-stop"
cmd4="-s"
des4="Pauses Music"
ex4="music -s"
com5="-play"
cmd5="-p"
des5="Plays Music"
ex5="music -p"
com6="-next"
cmd6="-n"
des6="Skips song"
ex6="music -n"
com7="-current"
cmd7="-c"
des7="Shows current track"
ex7="music -c"
echo ''
echo " ;;;;;; ███████ ███████ ██ ██ ███ ███ ██ ██ ███████ ██ ██████ "
sleep 0.01
echo " ; ; ███ ██ ██ ██ ████ ████ ██ ██ ██ ██ ██ "
sleep 0.01
echo " ; ; ███ ███████ ███████ ██ ████ ██ ██ ██ ███████ ██ ██ "
sleep 0.01
echo ",;; ,;; ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ "
sleep 0.01
echo "';; ';; ███████ ███████ ██ ██ ██ ██ ██████ ███████ ██ ██████ "
sleep 0.01
echo ""
sleep 0.01
# Print the table headers
printf "%-10s %-5s %-25s %-10s\n" "$header1" "$header2" "$header3" "$header4"
sleep 0.01
printf "%-10s %-5s %-25s %-10s\n" "$com1" "$cmd1" "$des1" "$ex1"
sleep 0.01
printf "%-10s %-5s %-25s %-10s\n" "$com2" "$cmd2" "$des2" "$ex2"
sleep 0.01
printf "%-10s %-5s %-25s %-10s\n" "$com3" "$cmd3" "$des3" "$ex3"
sleep 0.01
printf "%-10s %-5s %-25s %-10s\n" "$com4" "$cmd4" "$des4" "$ex4"
sleep 0.01
printf "%-10s %-5s %-25s %-10s\n" "$com5" "$cmd5" "$des5" "$ex5"
sleep 0.01
printf "%-10s %-5s %-25s %-10s\n" "$com6" "$cmd6" "$des6" "$ex6"
sleep 0.01
printf "%-10s %-5s %-25s %-10s\n" "$com7" "$cmd7" "$des7" "$ex7"
sleep 0.01
}