lf: fix xz/gz previews, remove gnumeric dependency
This commit is contained in:
parent
7f91cd7747
commit
0b1af9275f
1 changed files with 19 additions and 7 deletions
|
@ -30,6 +30,7 @@ archive() {
|
|||
}
|
||||
|
||||
csv() {
|
||||
f=${1:-$f}
|
||||
mlr --icsv --omd cat "$f" |
|
||||
CLICOLOR_FORCE=1 COLORTERM=truecolor \
|
||||
glow -w "$w" -s tokyo-night
|
||||
|
@ -73,11 +74,12 @@ word() {
|
|||
}
|
||||
|
||||
ods() {
|
||||
ssconvert \
|
||||
--export-type=Gnumeric_stf:stf_assistant \
|
||||
-O separator="$rs" \
|
||||
"$f" "fd://1" |
|
||||
column -t -s "$rs"
|
||||
td=$(mktemp -d)
|
||||
|
||||
libreoffice --headless --convert-to csv "$f" --outdir "$td"
|
||||
csv "${td}/${f%.*}.csv"
|
||||
|
||||
rm -rf "$td"
|
||||
}
|
||||
|
||||
odt() {
|
||||
|
@ -126,6 +128,14 @@ yaml() {
|
|||
$BAT --language=yaml "$f"
|
||||
}
|
||||
|
||||
gz_compressed() {
|
||||
gzip -l "$f"
|
||||
}
|
||||
|
||||
xz_compressed() {
|
||||
xz -l "$f"
|
||||
}
|
||||
|
||||
run() {
|
||||
if [ "$1" = "-s" ]; then
|
||||
cache="${CACHE_DIR}/$(
|
||||
|
@ -154,9 +164,11 @@ run() {
|
|||
preview() {
|
||||
mimetype=$1
|
||||
case "$mimetype" in
|
||||
*/vnd.openxmlformats-officedocument.spreadsheetml.sheet | */vnd.oasis.opendocument.spreadsheet) run ods ;;
|
||||
*/vnd.openxmlformats-officedocument.spreadsheetml.sheet | */vnd.oasis.opendocument.spreadsheet) run -s ods ;;
|
||||
*/vnd.sqlite3) run sqlite ;;
|
||||
*/x-7z-compressed | */vnd.rar | */x-tar | */zip | */x-java-archive | */x-xz | */gzip | */x-bzip-compressed-tar | */x-compressed-tar | */x-xz-compressed-tar) run archive ;;
|
||||
*/gzip) run gz_compressed ;;
|
||||
*/x-xz) run xz_compressed ;;
|
||||
*/x-7z-compressed | */vnd.rar | */x-tar | */zip | */x-java-archive | */x-bzip-compressed-tar | */x-compressed-tar | */x-xz-compressed-tar) run archive ;;
|
||||
*/epub+zip) run -s epub ;;
|
||||
image/svg+xml) run -s svg ;;
|
||||
image/*) run -s image ;;
|
||||
|
|
Loading…
Add table
Reference in a new issue