diff options
| author | August Feng <46177585+augustfengd@users.noreply.github.com> | 2024-08-11 14:01:39 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-11 20:01:39 +0200 |
| commit | 47767bd03cae60bc4b3d8ab4ba8e6b6c78bc17ed (patch) | |
| tree | 7e3857486def32f5fc9bec6a66d097a8fde02e74 /plugins/colorize | |
| parent | f1764f8a569a84264ad5a6182721f6ae3bba835d (diff) | |
| download | zsh-47767bd03cae60bc4b3d8ab4ba8e6b6c78bc17ed.tar.gz zsh-47767bd03cae60bc4b3d8ab4ba8e6b6c78bc17ed.tar.bz2 zsh-47767bd03cae60bc4b3d8ab4ba8e6b6c78bc17ed.zip | |
fix(colorize): support args when input is stdin (#11038)
Co-authored-by: August Feng <au.fengster@gmail.com>
Diffstat (limited to 'plugins/colorize')
| -rw-r--r-- | plugins/colorize/colorize.plugin.zsh | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/colorize/colorize.plugin.zsh b/plugins/colorize/colorize.plugin.zsh index 12841e0ee..c49acd864 100644 --- a/plugins/colorize/colorize.plugin.zsh +++ b/plugins/colorize/colorize.plugin.zsh @@ -42,12 +42,12 @@ colorize_cat() { ZSH_COLORIZE_STYLE="emacs" fi - # Use stdin if no arguments have been passed. - if [ $# -eq 0 ]; then + # Use stdin if stdin is not attached to a terminal. + if [ ! -t 0 ]; then if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then pygmentize -O style="$ZSH_COLORIZE_STYLE" -g else - chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}" + chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}" "$@" fi return $? fi |
