1
0
Fork 0

lf: prevent self dos

This commit is contained in:
Luca Bilke 2024-06-19 17:44:10 +02:00
parent 6446b3bfdd
commit 12fb74f77a
No known key found for this signature in database
GPG Key ID: C9E851809C1A5BDE
1 changed files with 4 additions and 3 deletions

View File

@ -23,7 +23,7 @@ video() {
}
text() {
for cmd in bat batcat cat; do
for cmd in bat batcat head; do
command -v $cmd >/dev/null 2>&1 && break
done
case $cmd in
@ -35,10 +35,11 @@ text() {
--pager=never \
--tabs=4 \
--theme=base16 \
--line-range=":$h" \
--terminal-width="$((w - 2))" "$@" "$f"
;;
cat)
$cmd "$f"
head)
head -n "$h" "$f"
;;
esac
}