From 0566b9b8a35d5175820113bc91bf0c3465ca9479 Mon Sep 17 00:00:00 2001 From: Eric Nielsen <4120606+ericbn@users.noreply.github.com> Date: Thu, 15 Jun 2023 09:33:14 -0500 Subject: [PATCH] Use _zimfw_print --- src/stage2/50_zimfw_check_version.zsh.erb | 4 +--- src/stage2/50_zimfw_compile.zsh.erb | 4 +--- src/stage2/75_zimfw_tool_degit.zsh.erb | 4 +--- src/stage2/75_zimfw_tool_git.zsh.erb | 4 +--- zimfw.zsh | 18 +++++------------- 5 files changed, 9 insertions(+), 25 deletions(-) diff --git a/src/stage2/50_zimfw_check_version.zsh.erb b/src/stage2/50_zimfw_check_version.zsh.erb index 7637d3a..963d73a 100644 --- a/src/stage2/50_zimfw_check_version.zsh.erb +++ b/src/stage2/50_zimfw_check_version.zsh.erb @@ -8,9 +8,7 @@ _zimfw_check_version() { fi local -r zlatest_version=$(<${_zversion_target}) if [[ -n ${zlatest_version} && ${_zversion} != ${zlatest_version} ]]; then - if (( _zprintlevel > 0 )); then - print -u2 -PR "%F{yellow}Latest zimfw version is %B${zlatest_version}%b. You're using version %B${_zversion}%b. Run %Bzimfw upgrade%b to upgrade.%f" - fi + _zimfw_print -u2 -PR "%F{yellow}Latest zimfw version is %B${zlatest_version}%b. You're using version %B${_zversion}%b. Run %Bzimfw upgrade%b to upgrade.%f" return 4 fi } diff --git a/src/stage2/50_zimfw_compile.zsh.erb b/src/stage2/50_zimfw_compile.zsh.erb index 74b7155..eebf78d 100644 --- a/src/stage2/50_zimfw_compile.zsh.erb +++ b/src/stage2/50_zimfw_compile.zsh.erb @@ -3,9 +3,7 @@ _zimfw_compile() { local zroot_dir zfile for zroot_dir in ${_zroot_dirs:|_zdisabled_root_dirs}; do if [[ ! -w ${zroot_dir} ]]; then - if (( _zprintlevel > 0 )); then - print -PR "%F{yellow}<%= warn %>%B${zroot_dir}:%b No write permission, unable to compile.%f" - fi + _zimfw_print -PR "%F{yellow}<%= warn %>%B${zroot_dir}:%b No write permission, unable to compile.%f" continue fi for zfile in ${zroot_dir}/(^*test*/)#*.zsh(|-theme)(N-.); do diff --git a/src/stage2/75_zimfw_tool_degit.zsh.erb b/src/stage2/75_zimfw_tool_degit.zsh.erb index d236fdc..fa3e9f6 100644 --- a/src/stage2/75_zimfw_tool_degit.zsh.erb +++ b/src/stage2/75_zimfw_tool_degit.zsh.erb @@ -102,9 +102,7 @@ _zimfw_tool_degit() { ;; check|update) if [[ ! -r ${INFO_TARGET} ]]; then - if (( _zprintlevel > 0 )); then - print -u2 -PR <%= clear_line %>"%F{yellow}<%= warn %>%B${_zname}:%b Module was not installed using Zim's degit. Will not try to ${_zaction}. Use zmodule option %B-z%b|%B--frozen%b to disable this warning.%f" - fi + _zimfw_print -u2 -PR <%= clear_line %>"%F{yellow}<%= warn %>%B${_zname}:%b Module was not installed using Zim's degit. Will not try to ${_zaction}. Use zmodule option %B-z%b|%B--frozen%b to disable this warning.%f" return 0 fi readonly DIR_NEW=${DIR}${TEMP} diff --git a/src/stage2/75_zimfw_tool_git.zsh.erb b/src/stage2/75_zimfw_tool_git.zsh.erb index af8f23f..347486c 100644 --- a/src/stage2/75_zimfw_tool_git.zsh.erb +++ b/src/stage2/75_zimfw_tool_git.zsh.erb @@ -14,9 +14,7 @@ _zimfw_tool_git() { ;; check|update) if [[ ! -r ${DIR}/.git ]]; then - if (( _zprintlevel > 0 )); then - print -u2 -PR <%= clear_line %>"%F{yellow}<%= warn %>%B${_zname}:%b Module was not installed using git. Will not try to ${_zaction}. Use zmodule option %B-z%b|%B--frozen%b to disable this warning.%f" - fi + _zimfw_print -u2 -PR <%= clear_line %>"%F{yellow}<%= warn %>%B${_zname}:%b Module was not installed using git. Will not try to ${_zaction}. Use zmodule option %B-z%b|%B--frozen%b to disable this warning.%f" return 0 fi if [[ ${URL} != $(command git -C ${DIR} config --get remote.origin.url) ]]; then diff --git a/zimfw.zsh b/zimfw.zsh index 8d8f52c..eb5251d 100644 --- a/zimfw.zsh +++ b/zimfw.zsh @@ -395,9 +395,7 @@ _zimfw_check_version() { fi local -r zlatest_version=$(<${_zversion_target}) if [[ -n ${zlatest_version} && ${_zversion} != ${zlatest_version} ]]; then - if (( _zprintlevel > 0 )); then - print -u2 -PR "%F{yellow}Latest zimfw version is %B${zlatest_version}%b. You're using version %B${_zversion}%b. Run %Bzimfw upgrade%b to upgrade.%f" - fi + _zimfw_print -u2 -PR "%F{yellow}Latest zimfw version is %B${zlatest_version}%b. You're using version %B${_zversion}%b. Run %Bzimfw upgrade%b to upgrade.%f" return 4 fi } @@ -424,9 +422,7 @@ _zimfw_compile() { local zroot_dir zfile for zroot_dir in ${_zroot_dirs:|_zdisabled_root_dirs}; do if [[ ! -w ${zroot_dir} ]]; then - if (( _zprintlevel > 0 )); then - print -PR "%F{yellow}! %B${zroot_dir}:%b No write permission, unable to compile.%f" - fi + _zimfw_print -PR "%F{yellow}! %B${zroot_dir}:%b No write permission, unable to compile.%f" continue fi for zfile in ${zroot_dir}/(^*test*/)#*.zsh(|-theme)(N-.); do @@ -439,7 +435,7 @@ _zimfw_compile() { } _zimfw_info() { - print -R 'zimfw version: '${_zversion}' (built at 2023-06-13 16:31:31 UTC, previous commit is db96076)' + print -R 'zimfw version: '${_zversion}' (built at 2023-06-15 14:32:20 UTC, previous commit is f9648e0)' local zparam for zparam in LANG ${(Mk)parameters:#LC_*} OSTYPE TERM TERM_PROGRAM TERM_PROGRAM_VERSION ZIM_HOME ZSH_VERSION; do print -R ${(r.22....:.)zparam}${(P)zparam} @@ -650,9 +646,7 @@ _zimfw_tool_degit() { ;; check|update) if [[ ! -r ${INFO_TARGET} ]]; then - if (( _zprintlevel > 0 )); then - print -u2 -PR $'\E[2K\r'"%F{yellow}! %B${_zname}:%b Module was not installed using Zim's degit. Will not try to ${_zaction}. Use zmodule option %B-z%b|%B--frozen%b to disable this warning.%f" - fi + _zimfw_print -u2 -PR $'\E[2K\r'"%F{yellow}! %B${_zname}:%b Module was not installed using Zim's degit. Will not try to ${_zaction}. Use zmodule option %B-z%b|%B--frozen%b to disable this warning.%f" return 0 fi readonly DIR_NEW=${DIR}${TEMP} @@ -710,9 +704,7 @@ _zimfw_tool_git() { ;; check|update) if [[ ! -r ${DIR}/.git ]]; then - if (( _zprintlevel > 0 )); then - print -u2 -PR $'\E[2K\r'"%F{yellow}! %B${_zname}:%b Module was not installed using git. Will not try to ${_zaction}. Use zmodule option %B-z%b|%B--frozen%b to disable this warning.%f" - fi + _zimfw_print -u2 -PR $'\E[2K\r'"%F{yellow}! %B${_zname}:%b Module was not installed using git. Will not try to ${_zaction}. Use zmodule option %B-z%b|%B--frozen%b to disable this warning.%f" return 0 fi if [[ ${URL} != $(command git -C ${DIR} config --get remote.origin.url) ]]; then