lf: prevent self dos
This commit is contained in:
parent
91367f94dc
commit
aa544a4da8
1 changed files with 4 additions and 3 deletions
|
@ -23,7 +23,7 @@ video() {
|
||||||
}
|
}
|
||||||
|
|
||||||
text() {
|
text() {
|
||||||
for cmd in bat batcat cat; do
|
for cmd in bat batcat head; do
|
||||||
command -v $cmd >/dev/null 2>&1 && break
|
command -v $cmd >/dev/null 2>&1 && break
|
||||||
done
|
done
|
||||||
case $cmd in
|
case $cmd in
|
||||||
|
@ -35,10 +35,11 @@ text() {
|
||||||
--pager=never \
|
--pager=never \
|
||||||
--tabs=4 \
|
--tabs=4 \
|
||||||
--theme=base16 \
|
--theme=base16 \
|
||||||
|
--line-range=":$h" \
|
||||||
--terminal-width="$((w - 2))" "$@" "$f"
|
--terminal-width="$((w - 2))" "$@" "$f"
|
||||||
;;
|
;;
|
||||||
cat)
|
head)
|
||||||
$cmd "$f"
|
head -n "$h" "$f"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue