1
0
Fork 0

cat-highlight: Don't try to use lesspipe

This commit is contained in:
tastytea 2022-03-20 00:26:38 +01:00
parent a649fd2f64
commit a7a404fa92
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
1 changed files with 9 additions and 0 deletions

View File

@ -4,6 +4,15 @@
# Check if we are in a terminal and $LESSOPEN is not empty
if [[ -t 1 && -n "${LESSOPEN}" ]]; then
# Programs that won't work with cat
local -a known_bad=("lesspipe")
for baddy in ${known_bad}; do
if [[ "${LESSOPEN}" =~ "${baddy}" ]]; then
\cat "${@}"
return ${?}
fi
done
local -a args
local -a files
for arg in "${@}"; do