bin: handle inspection of large directories without hang
This commit is contained in:
parent
38c2f48a55
commit
e9d7ad7305
|
@ -38,8 +38,14 @@ cd() {
|
||||||
test -n "$dir" && cd "$dir"
|
test -n "$dir" && cd "$dir"
|
||||||
else
|
else
|
||||||
builtin cd "$@" &&
|
builtin cd "$@" &&
|
||||||
command ls --literal --file-type --color=always --format=vertical -U -w $COLUMNS |
|
# we have to use two ls commands here, since:
|
||||||
#pr -4 -l1 -W $COLUMNS -S" " |
|
# - a single ls command hangs on multi-column formats when combined with color
|
||||||
|
# - column malaligns output with ANSI escape sequences (view with LESS="" less)
|
||||||
|
# column --fillrows --output-width $(expr $COLUMNS + 20)
|
||||||
|
# pr -4 -l1 -W $COLUMNS -S" "
|
||||||
|
command ls --sort=none --quote-name |
|
||||||
|
head -12 |
|
||||||
|
xargs ls --sort=time --format=vertical --directory --literal --file-type --color=always --width $COLUMNS |
|
||||||
head -3
|
head -3
|
||||||
code=$? && test $code -eq 141 || return $code
|
code=$? && test $code -eq 141 || return $code
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -64,8 +64,8 @@ for arg; do
|
||||||
(*\ application/*document*)
|
(*\ application/*document*)
|
||||||
# https://ask.libreoffice.org/t/convert-to-command-line-parameter/840/4
|
# https://ask.libreoffice.org/t/convert-to-command-line-parameter/840/4
|
||||||
echo Converting "$arg"
|
echo Converting "$arg"
|
||||||
soffice --headless --convert-to jpg --outdir "$prefix" "$arg" >/dev/null 2>&1
|
soffice --headless --convert-to png --outdir "$prefix" "$arg" >/dev/null
|
||||||
timg+=("${tmpfile%.*}.jpg")
|
timg+=("${tmpfile%.*}.png")
|
||||||
continue;;
|
continue;;
|
||||||
(*/x-xcf*)
|
(*/x-xcf*)
|
||||||
echo Converting "$arg"
|
echo Converting "$arg"
|
||||||
|
@ -169,5 +169,8 @@ fi
|
||||||
|
|
||||||
if test "$ls" -o $# -eq 0; then
|
if test "$ls" -o $# -eq 0; then
|
||||||
checkperm .
|
checkperm .
|
||||||
$elevate ls -l $(test $# -gt ${#ls[@]} && echo "-d") --color=always --human-readable --si --group-directories-first --file-type --dereference-command-line --all "${ls[@]:-.}" | less -RF
|
# Alternative: find -exec ls -dl {} +
|
||||||
|
{ timeout .1s $elevate ls -l $(test $# -gt ${#ls[@]} && echo "-d") --color=always --human-readable --si --group-directories-first --file-type --dereference-command-line-symlink-to-dir --all "${ls[@]:-.}" ||
|
||||||
|
$elevate ls $(test $# -gt ${#ls[@]} && echo "-d") --color=always --human-readable --si --dereference-command-line --all --sort=none "${ls[@]:-.}"
|
||||||
|
} | less -RF
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue