Fix warning when WARN_CREATE_GLOBAL is set

and ZIM_HOME is not. It can be reproduced with:

    unset ZIM_HOME
    setopt WARN_CREATE_GLOBAL
    zimfw info

and the warning is:

    zimfw.zsh:33: scalar parameter ZIM_HOME created globally in function zimfw
This commit is contained in:
Eric Nielsen 2021-08-31 18:41:26 -05:00
parent c021507ac7
commit 476bb6b320
No known key found for this signature in database
GPG Key ID: 47D1DBFA0765A1FB
2 changed files with 3 additions and 3 deletions

View File

@ -4,4 +4,4 @@ autoload -Uz is-at-least && if ! is-at-least <%= min_zsh_version %>; then
fi fi
# Define Zim location # Define Zim location
: ${ZIM_HOME=${0:A:h}} if (( ! ${+ZIM_HOME} )) typeset -g ZIM_HOME=${0:A:h}

View File

@ -30,7 +30,7 @@ autoload -Uz is-at-least && if ! is-at-least 5.2; then
fi fi
# Define Zim location # Define Zim location
: ${ZIM_HOME=${0:A:h}} if (( ! ${+ZIM_HOME} )) typeset -g ZIM_HOME=${0:A:h}
_zimfw_print() { _zimfw_print() {
if (( _zprintlevel > 0 )) print "${@}" if (( _zprintlevel > 0 )) print "${@}"
@ -338,7 +338,7 @@ _zimfw_compile() {
} }
_zimfw_info() { _zimfw_info() {
print -R 'zimfw version: '${_zversion}' (built at 2021-08-25 21:04:22 UTC, previous commit is e89793c)' print -R 'zimfw version: '${_zversion}' (built at 2021-08-31 23:40:27 UTC, previous commit is e56048f)'
print -R 'ZIM_HOME: '${ZIM_HOME} print -R 'ZIM_HOME: '${ZIM_HOME}
print -R 'Zsh version: '${ZSH_VERSION} print -R 'Zsh version: '${ZSH_VERSION}
print -R 'System info: '$(command uname -a) print -R 'System info: '$(command uname -a)