plugin/less-pretty-cat: remove `|| cat`
The logic to run `cat` if `pygmentize` fails seems useless, so just remove it.pull/1957/head
parent
5857648377
commit
2ddb40751f
|
|
@ -7,24 +7,17 @@ _command_exists pygmentize || return
|
||||||
# pigmentize cat and less outputs - call them ccat and cless to avoid that
|
# pigmentize cat and less outputs - call them ccat and cless to avoid that
|
||||||
# especially cat'ed output in scripts gets mangled with pygemtized meta characters
|
# especially cat'ed output in scripts gets mangled with pygemtized meta characters
|
||||||
function ccat() {
|
function ccat() {
|
||||||
about 'runs either pygmentize or cat on each file passed in'
|
about 'runs pygmentize on each file passed in'
|
||||||
param '*: files to concatenate (as normally passed to cat)'
|
param '*: files to concatenate (as normally passed to cat)'
|
||||||
example 'ccat mysite/manage.py dir/text-file.txt'
|
example 'ccat mysite/manage.py dir/text-file.txt'
|
||||||
|
|
||||||
local file
|
pygmentize -f 256 -O style="${BASH_IT_CCAT_STYLE:-default}" -g "$@"
|
||||||
: "${BASH_IT_CCAT_STYLE:=default}"
|
|
||||||
|
|
||||||
for file in "$@"; do
|
|
||||||
pygmentize -f 256 -O style="$BASH_IT_CCAT_STYLE" -g "$file" 2> /dev/null || command cat "$file"
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function cless() {
|
function cless() {
|
||||||
about 'pigments the file passed in and passes it to less for pagination'
|
about 'pigments the files passed in and passes to less for pagination'
|
||||||
param '1: the file to paginate with less'
|
param '*: the files to paginate with less'
|
||||||
example 'cless mysite/manage.py'
|
example 'cless mysite/manage.py'
|
||||||
|
|
||||||
: "${BASH_IT_CLESS_STYLE:=default}"
|
pygmentize -f 256 -O style="${BASH_IT_CLESS_STYLE:-default}" -g "$@" | command less -R
|
||||||
|
|
||||||
pygmentize -f 256 -O style="$BASH_IT_CLESS_STYLE" -g "$@" | command less -R
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue