diff --git a/.local/bin/scripts/b b/.local/bin/scripts/b index e2e9ac6..7a8ef67 100755 --- a/.local/bin/scripts/b +++ b/.local/bin/scripts/b @@ -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] " && 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] " && 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 diff --git a/.local/bin/scripts/help b/.local/bin/scripts/help index 2d12e04..3b4b96c 100755 --- a/.local/bin/scripts/help +++ b/.local/bin/scripts/help @@ -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;; diff --git a/.local/bin/scripts/synctray b/.local/bin/scripts/synctray index 22534ff..94d4dee 100755 --- a/.local/bin/scripts/synctray +++ b/.local/bin/scripts/synctray @@ -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