Compare commits

...

2 Commits

Author SHA1 Message Date
Eric Nielsen 0566b9b8a3
Use _zimfw_print 2023-06-15 09:33:14 -05:00
alesandar f9648e07a9
Handle module root directories without write permission
Closes #513. Fixes #512
2023-06-15 09:26:37 -05:00
5 changed files with 15 additions and 19 deletions

View File

@ -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
}

View File

@ -2,6 +2,10 @@ _zimfw_compile() {
# Compile Zim scripts
local zroot_dir zfile
for zroot_dir in ${_zroot_dirs:|_zdisabled_root_dirs}; do
if [[ ! -w ${zroot_dir} ]]; then
_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
if [[ ! ${zfile}.zwc -nt ${zfile} ]]; then
zcompile -UR ${zfile} && _zimfw_print -PR "<%= okay %>%B${zfile}.zwc:%b Compiled"

View File

@ -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}

View File

@ -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

View File

@ -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
}
@ -423,6 +421,10 @@ _zimfw_compile() {
# Compile Zim scripts
local zroot_dir zfile
for zroot_dir in ${_zroot_dirs:|_zdisabled_root_dirs}; do
if [[ ! -w ${zroot_dir} ]]; then
_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
if [[ ! ${zfile}.zwc -nt ${zfile} ]]; then
zcompile -UR ${zfile} && _zimfw_print -PR "%F{green})%f %B${zfile}.zwc:%b Compiled"
@ -433,7 +435,7 @@ _zimfw_compile() {
}
_zimfw_info() {
print -R 'zimfw version: '${_zversion}' (built at 2023-04-01 01:32:16 UTC, previous commit is 5db1155)'
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}
@ -644,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}
@ -704,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