Skip to content

Commit

Permalink
fix: update pygmentize flags in glance subcommand (#488)
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
  • Loading branch information
vladdoster committed Mar 26, 2023
1 parent 824d9d3 commit b773763
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions doc/zsdoc/zinit-autoload.zsh.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,7 @@ Has 39 line(s). Calls functions:
.zinit-glance
|-- zinit-side.zsh/.zinit-exists-physically-message
|-- zinit-side.zsh/.zinit-first
|-- zinit.zsh/+zinit-message
`-- zinit.zsh/.zinit-any-to-user-plugin
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
Expand Down
1 change: 1 addition & 0 deletions doc/zsdoc/zinit.zsh.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ Called by:
zinit-autoload.zsh/.zinit-cd
zinit-autoload.zsh/.zinit-confirm
zinit-autoload.zsh/.zinit-delete
zinit-autoload.zsh/.zinit-glance
zinit-autoload.zsh/.zinit-self-update
zinit-autoload.zsh/.zinit-show-zstatus
zinit-autoload.zsh/.zinit-uninstall-completions
Expand Down
14 changes: 7 additions & 7 deletions zinit-autoload.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -3048,7 +3048,7 @@ EOF
.zinit-exists-physically-message "$user" "$plugin" || return 1

.zinit-first "$1" "$2" || {
builtin print "${ZINIT[col-error]}No source file found, cannot glance${ZINIT[col-rst]}"
+zinit-message '{log-err} No source file found, cannot glance'
return 1
}

Expand All @@ -3059,17 +3059,17 @@ EOF

{
if (( ${+commands[pygmentize]} )); then
builtin print "Glancing with ${ZINIT[col-info]}pygmentize${ZINIT[col-rst]}"
pygmentize -l bash -g "$fname"
+zinit-message "{log-info} Inspecting via {cmd}pygmentize{rst}"
pygmentize -l 'bash' "$fname"
elif (( ${+commands[highlight]} )); then
builtin print "Glancing with ${ZINIT[col-info]}highlight${ZINIT[col-rst]}"
+zinit-message "{log-info} Inspecting via {cmd}highlight{rst}"
if (( has_256_colors )); then
highlight -q --force -S sh -O xterm256 "$fname"
highlight --force --output-format xterm256 --quiet --syntax sh "$fname"
else
highlight -q --force -S sh -O ansi "$fname"
highlight --force --output-format ansi --quiet --syntax sh "$fname"
fi
elif (( ${+commands[source-highlight]} )); then
builtin print "Glancing with ${ZINIT[col-info]}source-highlight${ZINIT[col-rst]}"
+zinit-message "{log-info} Inspecting via {cmd}source-highlight{rst}"
source-highlight -fesc --failsafe -s zsh -o STDOUT -i "$fname"
else
cat "$fname"
Expand Down

0 comments on commit b773763

Please sign in to comment.