bin: make b more compatible and draft duploc

This commit is contained in:
xeruf 2022-05-19 12:20:16 +02:00
parent 13105e0512
commit e74af0904b
2 changed files with 12 additions and 3 deletions

View File

@ -62,8 +62,8 @@ for arg; do
case "$mime" in
(*\ application/pdf\;*)
echo Converting "$arg"
test -f "$tmpfile-1.ppm" || pdftoppm -r 70 "$arg" "$tmpfile" -l $(expr $grid \& \( $grid \> 4 \| $# \> 1 \) \| $grid '*' 2)
timg -W --grid=$grid $tmpfile-{01..$grid}.ppm
test -f "$tmpfile-1.ppm" || pdftoppm -forcenum -r 70 "$arg" "$tmpfile" -l $(expr $grid \& \( $grid \> 4 \| $# \> 1 \) \| $grid '*' 2)
timg -W --grid=$grid "$tmpfile"*.ppm
;;
(*\ application/*document*)
# https://ask.libreoffice.org/t/convert-to-command-line-parameter/840/4
@ -151,7 +151,7 @@ if test "$bat" -o "$batplain"; then
test "$(bat --version | cut -d. -f2)" -gt 16 && rule=,rule
if test $# -gt ${#bat[@]} -a $# -gt ${#batplain[@]} && test -z "$flags"
then cut="--line-range :7"
batpager="cut -c-$(echo "$(tput cols)*1.9" | bc | cut -d. -f1)"
batpager="cut -c-$(echo $(tput cols) \* 19 / 10 | cut -d. -f1)"
fi
batcommand="$elevate bat $cut $flags --pager"
batstyle="--style plain$rule"

9
.local/bin/scripts/duploc Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
# Delete files under current or given path which exist elsewhere as listed in the locate database
# Matches first by name, then by checksum
# TODO
find "$@" -size +50M | while read filepath
do f="$(basename "$filepath" | synct-unarchive)"
highlight "$filepath"
locate -b "$f"
done