-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.lessfilter
More file actions
executable file
·28 lines (25 loc) · 817 Bytes
/
.lessfilter
File metadata and controls
executable file
·28 lines (25 loc) · 817 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
27
28
#!/usr/bin/env bash
# portions based on https://github.com/nojhan/dotfiles/blob/master/lessfilter.sh
case "$1" in
*.rb|Rakefile|*.rake|*.gemspec|Gemfile)
type -t pygmentize >/dev/null 2>&1 && pygmentize -f 256 -l ruby "$1"
;;
*.awk|*.groff|*.java|*.js|*.m4|*.php|*.pl|*.pm|*.pod|*.sh|*.ad[asb]|*.asm|*.inc|*.[ch]|*.[ch]pp|*.[ch]xx|*.cc|*.hh|*.lsp|*.l|*.pas|*.p|*.xml|*.xps|*.xsl|*.axp|*.ppd|*.pov|*.diff|*.patch|*.py|*.sql|*.ebuild|*.eclass)
type -t pygmentize >/dev/null 2>&1 && pygmentize -f 256 "$1"
;;
.bashrc|.bash_aliases|.bash_environment)
type -t pygmentize >/dev/null 2>&1 && pygmentize -f 256 -l sh "$1"
;;
*)
# fall back on file
case "$(file -L -b -i "$1" | cut -f 1)" in
text/x-shellscript)
pygmentize -f 256 -l sh "$1"
;;
*)
exit 1
;;
esac
;;
esac
exit 0