aboutsummaryrefslogtreecommitdiff
path: root/getyt
diff options
context:
space:
mode:
authoriceyrazor <iceyrazor@mailfence.com>2026-05-24 01:25:07 -0500
committericeyrazor <iceyrazor@mailfence.com>2026-05-24 01:25:07 -0500
commitd4e34ad096cfc15b9c537463dd3c08becc5dc84e (patch)
tree5f5a90c64a4cc07898f5a6579538fb985b5686fb /getyt
parent431ffd2edf3d52bbe8b7999dbd4f771d236fa065 (diff)
posix shell changes
removed ls | grep fixed miss spelled word
Diffstat (limited to 'getyt')
-rwxr-xr-xgetyt18
1 files changed, 10 insertions, 8 deletions
diff --git a/getyt b/getyt
index 5ea79e9..2ea3d6f 100755
--- a/getyt
+++ b/getyt
@@ -1,15 +1,17 @@
-#!/bin/bash
+#!/bin/sh
FZF_PREVIEW_LINES=20
-FZF_PREVIEW_COLUMN=3
+FZF_PREVIEW_COLUMNS=50
-cd "$(dirname "$0")"
+cd "$(dirname "$0")" || exit
has_chafa=0
while getopts "c" opt; do
case "$opt" in
- c) has_chafa=1
+ c) has_chafa=1;
+ break;
;;
+ *) break;;
esac
done
@@ -21,14 +23,14 @@ shift $((OPTIND-1))
playlist=$1
-if [ "$playlist" == "" ]; then
+if [ "$playlist" = "" ]; then
item="$(sqlite3 ./youtube_stuffs.db "select rowid,* from ytlist")"
else
item="$(sqlite3 ./youtube_stuffs.db "select rowid,* from ytlist where category='$playlist'")"
fi
-if [ "$has_chafa" == "1" ]; then
+if [ "$has_chafa" = "1" ]; then
item="$( printf -- "%s" "$item" | \
fzf --preview "./preview.sh {} | xargs chafa --clear -f sixel -s ${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}" \
| sed -- 's/|.*//g')"
@@ -41,7 +43,7 @@ fi
url=$(sqlite3 ./youtube_stuffs.db "select id from ytlist where rowid=$item")
if [ -z "$WAYLAND_DISPLAY" ]; then
- printf "https://youtube.com/watch?v=$url" | xclip -selection clipboard
+ printf -- "https://youtube.com/watch?v=%s" "$url" | xclip -selection clipboard
else
- printf "https://youtube.com/watch?v=$url" | wl-copy
+ printf -- "https://youtube.com/watch?v=%s" "$url" | wl-copy
fi