commit 83d3f38

hovercats  ·  2022-04-04 07:50:25 +0000 UTC
parent 8b0593a
dmpv: add case statement for new delete option
1 files changed,  +14, -2
M dmpv
M dmpv
+14, -2
 1@@ -2,12 +2,24 @@
 2 
 3 # A tiny script for launching videos inside Videos dir with mpv
 4 # No more need for a detached terminal taking up your screen space
 5+# you can also delete the selected video with -d option
 6 
 7 # set DIR variable to whatever floats your boat
 8 DIR="$HOME"/Videos
 9 
10-cd $DIR
11-  for file in "$DIR"/*; do
12+case $1 in
13+  -d)
14+   cd $DIR
15+   for file in "$DIR"/*; do
16+    [ -e "$file" ] || [ -L "$file" ] || continue
17+    printf "%s\n" "$file"
18+  done | awk -F "/" '{print $NF}' | dmenu -i -l 20 | xargs -I {} rm -rf {} 
19+  ;;
20+   *)
21+   cd $DIR
22+   for file in "$DIR"/*; do
23     [ -e "$file" ] || [ -L "$file" ] || continue
24     printf "%s\n" "$file"
25   done | awk -F "/" '{print $NF}' | dmenu -i -l 20 | xargs -I {} mpv {} 
26+  ;;
27+esac