mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-15 01:48:34 -07:00
feat(cli): style plugin README in omz plugin info
This commit is contained in:
parent
ec3cb127b2
commit
f4423ebd09
19
lib/cli.zsh
19
lib/cli.zsh
@ -397,8 +397,23 @@ function _omz::plugin::info {
|
|||||||
local readme
|
local readme
|
||||||
for readme in "$ZSH_CUSTOM/plugins/$1/README.md" "$ZSH/plugins/$1/README.md"; do
|
for readme in "$ZSH_CUSTOM/plugins/$1/README.md" "$ZSH/plugins/$1/README.md"; do
|
||||||
if [[ -f "$readme" ]]; then
|
if [[ -f "$readme" ]]; then
|
||||||
(( ${+commands[less]} )) && less "$readme" || cat "$readme"
|
# If being piped, just cat the README
|
||||||
return 0
|
if [[ ! -t 1 ]]; then
|
||||||
|
cat "$readme"
|
||||||
|
return $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Enrich the README display depending on the tools we have
|
||||||
|
# - glow: https://github.com/charmbracelet/glow
|
||||||
|
# - bat: https://github.com/sharkdp/bat
|
||||||
|
# - less: typical pager command
|
||||||
|
case 1 in
|
||||||
|
${+commands[glow]}) glow -p "$readme" ;;
|
||||||
|
${+commands[bat]}) bat -l md --style plain "$readme" ;;
|
||||||
|
${+commands[less]}) less "$readme" ;;
|
||||||
|
*) cat "$readme" ;;
|
||||||
|
esac
|
||||||
|
return $?
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user