commit 32eb1af

hovercats  ·  2026-08-20 20:02:15 +0000 UTC
parent 3d70ec3
use shorthand flags instead
1 files changed,  +11, -11
M ampv
M ampv
+11, -11
 1@@ -13,33 +13,33 @@ fn getfilepath {
 2 }
 3 
 4 switch($1) {
 5-	case add
 6+	case -a
 7 		songfile=`{getfilepath}
 8 		printf '%s\n' $"songfile >> $playlist
 9-	case del
10+	case -d
11 		songfile=`{getfilepath}
12 		grep -v $"songfile $playlist > $tmpfile
13 		mv -f $tmpfile $playlist
14-	case delete
15+	case -D
16 		songfile=`{getfilepath}
17 		rm -rf $"songfile
18-	case info
19+	case -i
20 		printf '{ "command": ["get_property", "filtered-metadata"] }\n' | \
21 			njetcat | \
22 			sed -e 's/{"data":{//' \
23 				-e 's/"},"request_id":0,"error":"success"}//' \
24 				-e 's/_/ /g' -e 's/":/: /g' -e 's/,"/\n/g' -e 's/"//g'
25-	case next
26+	case -n
27 		printf 'playlist-next\n' | njetcat
28-	case pause
29+	case -p
30 		printf 'cycle pause\n' | njetcat
31-	case prev
32+	case -P
33 		printf 'playlist-prev\n' | njetcat
34-	case shuffle
35+	case -s
36 		printf 'playlist-shuffle\n' | njetcat
37-	case start
38+	case -S
39 		player --idle &
40-	case play
41+	case -g
42 		shift
43 		if (~ $#* 0) {
44 			find $musicdir -type f -name *.opus > /tmp/.music
45@@ -50,6 +50,6 @@ switch($1) {
46 	case unshuffle
47 		printf 'playlist-unshuffle\n' | njetcat
48 	case *
49-		printf 'Usage: ampv next|pause|prev|shuffle|start|play\n'
50+		printf 'Usage: ampv -a|-d|-D|-i|-n|-p|-P|-s|-S|-g\n'
51 		exit 1
52 }