highlight > ccat

This commit is contained in:
David Chen 2020-03-06 17:43:05 -08:00
parent 49afb96134
commit 0e5c935855

View file

@ -217,20 +217,10 @@ handle_mime() {
case "${mimetype}" in
# Text
text/* | */xml)
# Syntax highlight
if [[ "$( stat --printf='%s' -- "${FILE_PATH}" )" -gt "${HIGHLIGHT_SIZE_MAX}" ]]; then
exit 2
if command -v ccat 2>/dev/null; then
ccat --color=always ${FILE_PATH}
exit 0
fi
if [[ "$( tput colors )" -ge 256 ]]; then
local pygmentize_format='terminal256'
local highlight_format='xterm256'
else
local pygmentize_format='terminal'
local highlight_format='ansi'
fi
highlight --replace-tabs="${HIGHLIGHT_TABWIDTH}" --out-format="${highlight_format}" \
--style="${HIGHLIGHT_STYLE}" --force -- "${FILE_PATH}" && exit 5
# pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}" -- "${FILE_PATH}" && exit 5
exit 2;;
# DjVu