1
0
Fork 0
mirror of synced 2024-12-25 23:43:20 -05:00

Initalization options are all auto or all manual

in `zmodule`, since there's no way to unset a default value to "nothing".
This commit is contained in:
Eric Nielsen 2021-09-26 19:47:44 -05:00
parent b1edcf34d0
commit 1d5c0c18d1
No known key found for this signature in database
GPG key ID: 47D1DBFA0765A1FB
3 changed files with 22 additions and 15 deletions

View file

@ -13,6 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Be quieter and don't output warnings when `-q` is provided.
- Manually setting any `zmodule` initialization option will disable all the
default values from the other initialization options, so only user-provided
values are used in this case. I.e. it's either all automatic, or all manual.
### Fixed
- Error in `zimfw update` with the `git` tool when module directory is under a

View file

@ -36,7 +36,11 @@ Initialization options:
%B-c%b|%B--cmd%b <command> Execute specified command. Occurrences of the %B{}%b placeholder in the
command are substituted by the module root directory path.
I.e., %B-s 'script.zsh'%b and %B-c 'source {}/script.zsh'%b are equivalent.
%B-d%b|%B--disabled%b Don't initialize or uninstall the module."
%B-d%b|%B--disabled%b Don't initialize or uninstall the module.
Setting any initialization option above will disable all the default values from the other ini-
tialization options, so only your provided values are used. I.e. these values are either all
automatic, or all manual."
if [[ ${${funcfiletrace[1]%:*}:t} != .zimrc ]]; then
print -u2 -PRl "%F{red}${0}: Must be called from %B<%= home %>/.zimrc%b%f" '' ${zusage}
return 2
@ -153,8 +157,11 @@ Initialization options:
_zfailed=1
return 1
fi
if (( ! ${#zfpaths} && ! ${#zcmds} )); then
if (( ! ${#zfpaths} && ! ${#zfunctions} && ! ${#zcmds} )); then
zfpaths=(${zdir}/functions(NF))
# _* functions are autoloaded by compinit
# prompt_*_setup functions are autoloaded by promptinit
zfunctions=(${^zfpaths}/^(*~|*.zwc(|.old)|_*|prompt_*_setup)(N-.:t))
local -ra prezto_scripts=(${zdir}/init.zsh(N))
if (( ${#zfpaths} && ${#prezto_scripts} )); then
# this follows the prezto module format, no need to check for other scripts
@ -165,11 +172,6 @@ Initialization options:
zcmds=("source ${^zscripts[@]:A}")
fi
fi
if (( ! ${#zfunctions} )); then
# _* functions are autoloaded by compinit
# prompt_*_setup functions are autoloaded by promptinit
zfunctions=(${^zfpaths}/^(*~|*.zwc(|.old)|_*|prompt_*_setup)(N-.:t))
fi
if (( ! ${#zfpaths} && ! ${#zfunctions} && ! ${#zcmds} )); then
_zimfw_print -u2 -PRl "%F{yellow}<%= warn %>${funcfiletrace[1]}:%B${zmodule}:%b Nothing found to be initialized. Customize the module name or initialization with %Bzmodule%b options.%f" '' ${zusage}
fi

View file

@ -146,7 +146,11 @@ Initialization options:
%B-c%b|%B--cmd%b <command> Execute specified command. Occurrences of the %B{}%b placeholder in the
command are substituted by the module root directory path.
I.e., %B-s 'script.zsh'%b and %B-c 'source {}/script.zsh'%b are equivalent.
%B-d%b|%B--disabled%b Don't initialize or uninstall the module."
%B-d%b|%B--disabled%b Don't initialize or uninstall the module.
Setting any initialization option above will disable all the default values from the other ini-
tialization options, so only your provided values are used. I.e. these values are either all
automatic, or all manual."
if [[ ${${funcfiletrace[1]%:*}:t} != .zimrc ]]; then
print -u2 -PRl "%F{red}${0}: Must be called from %B${ZDOTDIR:-${HOME}}/.zimrc%b%f" '' ${zusage}
return 2
@ -263,8 +267,11 @@ Initialization options:
_zfailed=1
return 1
fi
if (( ! ${#zfpaths} && ! ${#zcmds} )); then
if (( ! ${#zfpaths} && ! ${#zfunctions} && ! ${#zcmds} )); then
zfpaths=(${zdir}/functions(NF))
# _* functions are autoloaded by compinit
# prompt_*_setup functions are autoloaded by promptinit
zfunctions=(${^zfpaths}/^(*~|*.zwc(|.old)|_*|prompt_*_setup)(N-.:t))
local -ra prezto_scripts=(${zdir}/init.zsh(N))
if (( ${#zfpaths} && ${#prezto_scripts} )); then
# this follows the prezto module format, no need to check for other scripts
@ -275,11 +282,6 @@ Initialization options:
zcmds=("source ${^zscripts[@]:A}")
fi
fi
if (( ! ${#zfunctions} )); then
# _* functions are autoloaded by compinit
# prompt_*_setup functions are autoloaded by promptinit
zfunctions=(${^zfpaths}/^(*~|*.zwc(|.old)|_*|prompt_*_setup)(N-.:t))
fi
if (( ! ${#zfpaths} && ! ${#zfunctions} && ! ${#zcmds} )); then
_zimfw_print -u2 -PRl "%F{yellow}! ${funcfiletrace[1]}:%B${zmodule}:%b Nothing found to be initialized. Customize the module name or initialization with %Bzmodule%b options.%f" '' ${zusage}
fi
@ -371,7 +373,7 @@ _zimfw_compile() {
}
_zimfw_info() {
print -R 'zimfw version: '${_zversion}' (built at 2021-09-23 19:29:01 UTC, previous commit is 6ca4690)'
print -R 'zimfw version: '${_zversion}' (built at 2021-09-27 00:46:27 UTC, previous commit is b1edcf3)'
print -R 'ZIM_HOME: '${ZIM_HOME}
print -R 'Zsh version: '${ZSH_VERSION}
print -R 'System info: '$(command uname -a)