summaryrefslogtreecommitdiff
path: root/dmpv
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2025-08-30 01:09:18 -0500
committerzachir <zachir@librem.one>2025-08-30 01:09:18 -0500
commitf28d694879239d5d9c319185a278236d317a49b6 (patch)
tree3f684e05c6372c8f0fc0b9f126a184f3aaad68d4 /dmpv
parent7d3cbe8f708772e40608260590b717dea6735908 (diff)
Make sh scrips POSIX compliant
Using shellcheck, I went through all of them to make them standards compliant. I also tested as many as I could.
Diffstat (limited to 'dmpv')
-rwxr-xr-xdmpv25
1 files changed, 11 insertions, 14 deletions
diff --git a/dmpv b/dmpv
index d0dc214..dc98c80 100755
--- a/dmpv
+++ b/dmpv
@@ -1,6 +1,6 @@
#!/bin/sh
-cd ~/Videos
+cd ~/Videos || exit
case "$@" in
"-l")
LOOP="true"
@@ -12,12 +12,12 @@ esac
playvid () {
while true; do
- VIDEO=$(printf ".\n%s\n" "$(ls)" | uniq | dmenu -l 15 "$@")
- [ -z $VIDEO ] && exit
+ VIDEO=$(find "$HOME/Videos" | uniq | dmenu -l 15)
+ [ -z "$VIDEO" ] && exit
if [ "$VIDEO" = "." ]; then
break;
fi
- [ -d $VIDEO ] && cd $VIDEO && continue
+ [ -d "$VIDEO" ] && cd "$VIDEO" && continue
[ -f "$VIDEO" ] && break
pwd
done
@@ -25,12 +25,11 @@ playvid () {
}
printhelp () {
- printf \
- "Usage: dmpv [-l] [-h]\n" \
- "dmpv is a simple dmenu interface for playing content with mpv\n" \
- "dmpv assumes videos are stored in ~/Videos\n" \
- " -h\t\tprint this help message\n" \
- " -l\t\trun the prompt again after mpv exits\n"
+ printf "Usage: dmpv [-l] [-h]\n"
+ printf "dmpv is a simple dmenu interface for playing content with mpv\n"
+ printf "dmpv assumes videos are stored in ~/Videos\n"
+ printf " -h\t\tprint this help message\n"
+ printf " -l\t\trun the prompt again after mpv exits\n"
}
if [ -n "$HELP" ]; then
@@ -39,8 +38,6 @@ elif [ -n "$LOOP" ]; then
while true; do
playvid || exit 0
done
-fi
-
-playvid
- done
+else
+ playvid
fi