=== modified file 'bin/confz' --- bin/confz 2014-06-19 16:50:45 +0000 +++ bin/confz 2014-06-19 16:38:26 +0000 @@ -1,8 +1,6 @@ #!/bin/zsh # vim: ft=zsh noet ts=4 sts=4 sw=4 -autoload -Uz colors; colors - setopt extended_glob warn_create_global typeset -gA vars vars_prev @@ -13,28 +11,33 @@ # helper that prints out error message and exits die() { - print -r - "$fg[red]*$fg[default] $@" >&2 + print -r - ${(p)confz_err_mark} "$@" >&2 exit 1 } +confz_err_mark="%F{red}*%f" # trace-printing helpers +confz_exe_mark="%F{yellow}*%f" + confz_check_start() { - print -r - "${confz_indent}checking $fg_bold$1$fg_no_bold ${(@q)argv[2,-1]} $fg[black][$reset_color" + print -Pn "${confz_indent}checking %B$1%b " + print -rn - ${(@q)argv[2,-1]} + print -P " [" confz_indent+=" " } confz_check_ok() { confz_indent=${confz_indent% } - print -r - "$confz_indent] $fg[green]$1$reset_color OK" + print -P "$confz_indent] %F{green}$1%f OK" } confz_check_fail() { confz_indent=${confz_indent% } - print -P "$confz_indent] $fg[yellow]$1$reset_color FAIL" + print -P "$indent] %F{yellow}$1%f FAIL" } confz_do() { - print -r - "$confz_indent$fg[yellow]*$fg[default] ${(q)@}" + print -r - $confz_indent${(p)confz_exe_mark} "${(q)@}" "$@" || die "command failed with error $?: ${(q)@}" }