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' opts='itvh'
while getopts "$opts" OPTION; do while getopts "$opts" OPTION; do
case "$OPTION" in case "$OPTION" in
# inspect: Show file info without preview # inspect: Show file info without preview
(i) inspect=true;; (i) inspect=true;;
(t) tree=true;; (t) tree=true;;
(v) set -eo xtrace;; (v) set -eo xtrace;
export PS4='+\#> ';;
(h|?) echo "Usage: $(basename $0) [-$opts] <paths...>" && exit 2;; (h|?) echo "Usage: $(basename $0) [-$opts] <paths...>" && exit 2;;
esac esac
done done
shift "$(($OPTIND -1))" shift "$(($OPTIND -1))"
@ -65,7 +66,7 @@ for arg; do
fi fi
# amount of columns in a grid # amount of columns in a grid
grid=$(expr $(tput cols) / \( 25 - \( $# / 2 \) \& $# \< 30 \| 5 \)) 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" mkdir -p "$prefix"
case "$mime" in case "$mime" in
(*\ application/pdf\;*) (*\ application/pdf\;*)
@ -193,7 +194,8 @@ if test "$bat" -o "$batplain"; then
cp "$file" "$txt" cp "$file" "$txt"
timgtxt+=("$txt") timgtxt+=("$txt")
done 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[@]}" #fileinfo "${bat[@]}"
;; ;;
(*) for file in "${bat[@]}"; do (*) for file in "${bat[@]}"; do

View File

@ -29,7 +29,7 @@ case "$cmd" in
# Non-standard help flags # Non-standard help flags
(doom) "$@" --help;; (doom) "$@" --help;;
(mpw) "$@" -h 2>&1 | $paginate;; (mpw) "$@" -h 2>&1 | $paginate;;
(plantuml) unbuffer "$@" -help | $paginate;; (plantuml|java) unbuffer "$@" -help | $paginate;;
(rails) { "$@" -H && "$@" --help; } | $paginate;; (rails) { "$@" -H && "$@" --help; } | $paginate;;
(vlc) shift && unbuffer vlc --full-help "$@" | $paginate;; (vlc) shift && unbuffer vlc --full-help "$@" | $paginate;;
(kdeconnect*) shift && kdeconnect-cli --help-all "$@" | $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 suffix=$1
yay --noconfirm -Syyu --nobatchinstall c++utilities$suffix qtforkawesome$suffix qtutilities$suffix yay --noconfirm -Syyu --nobatchinstall c++utilities$suffix qtforkawesome$suffix qtutilities$suffix
yay --noconfirm -S syncthingtray$suffix yay --noconfirm -S syncthingtray$suffix