-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlessfilter
More file actions
executable file
·27 lines (24 loc) · 852 Bytes
/
lessfilter
File metadata and controls
executable file
·27 lines (24 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh
case "$1" in
*.md)
extension-handler "$1"
pandoc -s -f markdown -t man "$1"|groff -T utf8 -man -
;;
# TODO: can generate list with:
# pygmentize -L lexers | sed -n 's/^.*(filenames \(.*\))/\1/p' | tr ',' '\n' | sed 's/\s\+//' | grep -v '^\s*$' | sort | uniq
*.java|*.c|*.pl|*.pm|*.rb|*.sql|*.sh|*.cpp|*.cc|*.h|*.go|*.xml|*.hs|*.py|*.html|*.css|*.js|*.json|*.wsdl|*.sh|*.bash|*bashrc|*profile|*vimrc)
# pygmentize -L styles to list styles
command -v pygmentize -S friendly 1>&- || exit 1
extension-handler "$1"
pygmentize "$1"
;;
*.gpg)
# TODO: could apply this script again to underlying file ...
gpg -d "$1"
;;
*)
# We don't handle this format.
exit 1
esac
# No further processing by lesspipe necessary
exit 0