Show a more informative error when running zmodule

from the shell. This means getting

    zmodule: Must be called from ${ZDOTDIR:-${HOME}}/.zimrc

and the full zmodule usage, instead of getting

    zsh: command not found: zmodule

Fixes #430
This commit is contained in:
Eric Nielsen 2021-09-20 21:14:12 -05:00
parent b3b282f0f6
commit 7deda9c7f4
No known key found for this signature in database
GPG Key ID: 47D1DBFA0765A1FB
4 changed files with 15 additions and 3 deletions

View File

@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Error in `zimfw update` with the `git` tool when module directory is under a
symlinked directory.
- Warning when `WARN_CREATE_GLOBAL` is set and `ZIM_HOME` is not.
- "zsh: command not found: zmodule" when trying to run `zmodule` from the shell.
Show a more informative error instead.
- Don't try to install or update external modules.
## [1.5.0] - 2021-08-10

View File

@ -6,6 +6,7 @@ _zimfw_build_init() {
fi
_zimfw_mv =(
print -R "zimfw() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }"
print -R "zmodule() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }"
local -r zpre=$'*\0'
if (( ${#_zfpaths} )) print -R 'fpath=('${${_zfpaths#${~zpre}}:A}' ${fpath})'
if (( ${#_zfunctions} )) print -R 'autoload -Uz '${_zfunctions#${~zpre}}

View File

@ -49,4 +49,8 @@ zim = Zim.new
<%= zim.render_commented("LICENSE") %>
<%= zim.render_all("src/stage2/*.erb") %>
if [[ ${functrace[1]} == zmodule:* ]]; then
zmodule "${@}"
else
zimfw "${@}"
fi

View File

@ -59,6 +59,7 @@ _zimfw_build_init() {
fi
_zimfw_mv =(
print -R "zimfw() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }"
print -R "zmodule() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }"
local -r zpre=$'*\0'
if (( ${#_zfpaths} )) print -R 'fpath=('${${_zfpaths#${~zpre}}:A}' ${fpath})'
if (( ${#_zfunctions} )) print -R 'autoload -Uz '${_zfunctions#${~zpre}}
@ -367,7 +368,7 @@ _zimfw_compile() {
}
_zimfw_info() {
print -R 'zimfw version: '${_zversion}' (built at 2021-09-19 18:30:02 UTC, previous commit is 3e1a89a)'
print -R 'zimfw version: '${_zversion}' (built at 2021-09-21 01:00:09 UTC, previous commit is b3b282f)'
print -R 'ZIM_HOME: '${ZIM_HOME}
print -R 'Zsh version: '${ZSH_VERSION}
print -R 'System info: '$(command uname -a)
@ -781,4 +782,8 @@ Options:
esac
}
if [[ ${functrace[1]} == zmodule:* ]]; then
zmodule "${@}"
else
zimfw "${@}"
fi