1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-10-16 19:50:09 +00:00

fix(colorize): support args when input is stdin

This commit is contained in:
August Feng 2022-07-05 19:38:27 -04:00
parent 4c82a2eedf
commit 8cb555e7a9

View file

@ -42,12 +42,12 @@ colorize_cat() {
ZSH_COLORIZE_STYLE="emacs" ZSH_COLORIZE_STYLE="emacs"
fi fi
# Use stdin if no arguments have been passed. # Use stdin if stdin is not attached to a terminal.
if [ $# -eq 0 ]; then if [ ! -t 0 ]; then
if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g pygmentize -O style="$ZSH_COLORIZE_STYLE" -g
else else
chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}" chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}" "$@"
fi fi
return $? return $?
fi fi