bin: fix little issues in b

This commit is contained in:
xeruf 2022-12-25 22:05:58 +01:00
parent bd25412eeb
commit 8a8f31219e
3 changed files with 14 additions and 11 deletions

View File

@ -18,13 +18,14 @@ inspect=false
opts='itvh'
while getopts "$opts" OPTION; do
case "$OPTION" in
# inspect: Show file info without preview
(i) inspect=true;;
(t) tree=true;;
(v) set -eo xtrace;;
(h|?) echo "Usage: $(basename $0) [-$opts] <paths...>" && exit 2;;
esac
case "$OPTION" in
# inspect: Show file info without preview
(i) inspect=true;;
(t) tree=true;;
(v) set -eo xtrace;
export PS4='+\#> ';;
(h|?) echo "Usage: $(basename $0) [-$opts] <paths...>" && exit 2;;
esac
done
shift "$(($OPTIND -1))"
@ -65,7 +66,7 @@ for arg; do
fi
# amount of columns in a grid
grid=$(expr $(tput cols) / \( 25 - \( $# / 2 \) \& $# \< 30 \| 5 \))
tmpfile="$prefix/$(basename "$arg")_$(dd "if=$arg" bs=512 count=10 2>/dev/null | md5sum | tr -d ' ')"
tmpfile="$prefix/$(basename "$arg")_$(dd "if=$arg" bs=512 count=10 2>/dev/null | md5sum | tr -d ' ' || true)"
mkdir -p "$prefix"
case "$mime" in
(*\ application/pdf\;*)
@ -193,7 +194,8 @@ if test "$bat" -o "$batplain"; then
cp "$file" "$txt"
timgtxt+=("$txt")
done
timg -V --grid="$(expr 4 \& ${#bat[@]} \> 5 \| ${#bat[@]})" --title="%b" --frames=3 "${timgtxt[@]}"
timg -V --grid="$(expr 4 \& ${#bat[@]} \> 5 \| ${#bat[@]})" --title="%b" --frames=3 "${timgtxt[@]}" ||
head -3 "${timgtxt[@]}"
#fileinfo "${bat[@]}"
;;
(*) for file in "${bat[@]}"; do

View File

@ -29,7 +29,7 @@ case "$cmd" in
# Non-standard help flags
(doom) "$@" --help;;
(mpw) "$@" -h 2>&1 | $paginate;;
(plantuml) unbuffer "$@" -help | $paginate;;
(plantuml|java) unbuffer "$@" -help | $paginate;;
(rails) { "$@" -H && "$@" --help; } | $paginate;;
(vlc) shift && unbuffer vlc --full-help "$@" | $paginate;;
(kdeconnect*) shift && kdeconnect-cli --help-all "$@" | $paginate;;

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/sh -ex
# Install syncthingtray with dependencies
suffix=$1
yay --noconfirm -Syyu --nobatchinstall c++utilities$suffix qtforkawesome$suffix qtutilities$suffix
yay --noconfirm -S syncthingtray$suffix