mirror of
https://github.com/zplug/zplug
synced 2025-04-05 23:29:10 +02:00
67 lines
1.6 KiB
Bash
67 lines
1.6 KiB
Bash
#!/usr/bin/env zsh
|
|
# Description:
|
|
# Show the report of zplug errors
|
|
|
|
if [[ ! -f $_zplug_log[trace] ]] || [[ ! -s $_zplug_log[trace] ]]; then
|
|
__zplug::io::print::f \
|
|
--die \
|
|
--zplug \
|
|
--error \
|
|
"The trace log is not found or empty\n"
|
|
return 1
|
|
fi
|
|
|
|
local arg
|
|
|
|
while (( $# > 0 ))
|
|
do
|
|
arg="$1"
|
|
case "$arg" in
|
|
edit)
|
|
${=${2:+$2}:-${EDITOR:-vim}} "$_zplug_log[trace]"
|
|
return $status
|
|
;;
|
|
jq)
|
|
if (( ! $+commands[jq] )); then
|
|
return 1
|
|
fi
|
|
command cat "$_zplug_log[trace]" \
|
|
| sed -e 's/[[:cntrl:]]//g' \
|
|
| jq ${=${2:+"$argv[2,-1]"}:-"."}
|
|
return $status
|
|
;;
|
|
less | more)
|
|
# $PAGER
|
|
command cat "$_zplug_log[trace]" | ${=arg}
|
|
return $status
|
|
;;
|
|
clear)
|
|
rm -i "$_zplug_log[trace]"
|
|
return $status
|
|
;;
|
|
count)
|
|
command cat "$_zplug_log[trace]" | grep -c ''
|
|
return $status
|
|
;;
|
|
latest)
|
|
command cat "$_zplug_log[trace]" \
|
|
| tail -n ${${2:+"$argv[2,-1]"}:-1} \
|
|
| ${=${${commands[jq]:+"jq ."}:-"command cat -"}}
|
|
return $status
|
|
;;
|
|
"")
|
|
;;
|
|
*)
|
|
__zplug::io::print::f \
|
|
--die \
|
|
--zplug \
|
|
--func \
|
|
"$arg: invalid arguments\n"
|
|
return 1
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
command cat "$_zplug_log[trace]"
|