implement feedback

pull/1428/head
markusdd 2019-10-07 14:19:38 +02:00 committed by GitHub
parent c0ac3d8393
commit c9054e25a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 6 deletions

View File

@ -5,6 +5,8 @@ if $(command -v pygmentize &> /dev/null) ; then
# get the full paths to binaries # get the full paths to binaries
CAT_BIN=$(which cat) CAT_BIN=$(which cat)
LESS_BIN=$(which less) LESS_BIN=$(which less)
BASH_IT_CCAT_STYLE="${BASH_IT_CCAT_STYLE:=default}"
BASH_IT_CLESS_STYLE="${BASH_IT_CLESS_STYLE:=default}"
# 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
@ -13,9 +15,6 @@ if $(command -v pygmentize &> /dev/null) ; then
about 'runs either pygmentize or cat on each file passed in' about 'runs either pygmentize or cat on each file passed in'
param '*: files to concatenate (as normally passed to cat)' param '*: files to concatenate (as normally passed to cat)'
example 'cat mysite/manage.py dir/text-file.txt' example 'cat mysite/manage.py dir/text-file.txt'
if [ -z "$BASH_IT_CCAT_STYLE" ]; then
BASH_IT_CCAT_STYLE=default;
fi
for var; for var;
do do
pygmentize -f 256 -O style="$BASH_IT_CCAT_STYLE" -g "$var" 2>/dev/null || "$CAT_BIN" "$var"; pygmentize -f 256 -O style="$BASH_IT_CCAT_STYLE" -g "$var" 2>/dev/null || "$CAT_BIN" "$var";
@ -27,9 +26,6 @@ if $(command -v pygmentize &> /dev/null) ; then
about 'it pigments the file passed in and passes it to less for pagination' about 'it pigments the file passed in and passes it to less for pagination'
param '$1: the file to paginate with less' param '$1: the file to paginate with less'
example 'less mysite/manage.py' example 'less mysite/manage.py'
if [ -z "$BASH_IT_CLESS_STYLE" ]; then
BASH_IT_CLESS_STYLE=default;
fi
pygmentize -f 256 -O style="$BASH_IT_CLESS_STYLE" -g $* | "$LESS_BIN" -R pygmentize -f 256 -O style="$BASH_IT_CLESS_STYLE" -g $* | "$LESS_BIN" -R
} }
fi fi