about summary refs log tree commit diff
path: root/configs/configs_root_dir/home/xyz/.config/lf/previewer
blob: 8ef5d6a46093be852dbca8d37bade836a93bb4e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
# not using it because security concerns, see: https://wiki.archlinux.org/title/Lf#Sandboxing_previews

# references:
# `man lf` PREVIEWING FILES section
# maybe useful:
# https://github.com/LukeSmithxyz/voidrice/tree/master/.config/lf
# https://github.com/ranger/ranger/blob/master/ranger/data/scope.sh

case "$1" in
	# atool has more outputs like file mode bits but slower
	#*.7z|*.zip|*.tar*) atool -l "$1";;
	*.tar*) tar tf "$1";;
	*.zip) unzip -l "$1";;
	*.rar) unrar-free l "$1";;
	*.7z) 7z l "$1";;
	# pdftotext has better output than mutool
	*.pdf) pdftotext "$1" -;;
	#*.pdf) mutool draw -F txt "$1";;
	*) highlight -O ansi -t4 "$1";;
esac