Update init action to also install new modules

so users don't get a "Not installed" error when they add a new module to
.zimrc and forget to run `zimfw install` after that.

See #440
This commit is contained in:
Eric Nielsen 2021-10-26 11:15:40 -05:00
parent a86f69a2f1
commit 4259e64d22
No known key found for this signature in database
GPG Key ID: 47D1DBFA0765A1FB
4 changed files with 18 additions and 9 deletions

View File

@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- 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.
- Also install new modules when starting a new shell (via `zimfw init`, that
is sourced in .zshrc).
### Fixed
- Error in `zimfw update` with the `git` tool when module directory is under a

View File

@ -0,0 +1,5 @@
_zimfw_install_update() {
_zimfw_source_zimrc 1 ${1} && \
zargs -n 9 -P 0 -- "${_zmodules_zargs[@]}" -- _zimfw_run_tool && \
_zimfw_print -PR "<%= done %>Done with ${1}. Restart your terminal for any changes to take effect."
}

View File

@ -46,7 +46,7 @@ Options:
(( _zprintlevel-- ))
_zimfw_compile
;;
init) _zimfw_source_zimrc 2 && _zimfw_build ;;
init) _zimfw_install_update install && _zimfw_source_zimrc 2 && _zimfw_build ;;
clean) _zimfw_source_zimrc 2 && _zimfw_clean_compiled && _zimfw_clean_dumpfile ;;
clean-compiled) _zimfw_source_zimrc 2 && _zimfw_clean_compiled ;;
clean-dumpfile) _zimfw_clean_dumpfile ;;
@ -58,9 +58,7 @@ Options:
_zimfw_list_unuseds ' (unused)'
;;
install|update)
_zimfw_source_zimrc 1 ${1} && \
zargs -n 9 -P 0 -- "${_zmodules_zargs[@]}" -- _zimfw_run_tool && \
_zimfw_print -PR "<%= done %>Done with ${1}. Restart your terminal for any changes to take effect." || return 1
_zimfw_install_update ${1} || return 1
(( _zprintlevel-- ))
_zimfw_source_zimrc 2 && _zimfw_build && _zimfw_compile
;;

View File

@ -373,12 +373,18 @@ _zimfw_compile() {
}
_zimfw_info() {
print -R 'zimfw version: '${_zversion}' (built at 2021-10-19 13:32:17 UTC, previous commit is de7d2b1)'
print -R 'zimfw version: '${_zversion}' (built at 2021-10-26 15:35:30 UTC, previous commit is a86f69a)'
print -R 'ZIM_HOME: '${ZIM_HOME}
print -R 'Zsh version: '${ZSH_VERSION}
print -R 'System info: '$(command uname -a)
}
_zimfw_install_update() {
_zimfw_source_zimrc 1 ${1} && \
zargs -n 9 -P 0 -- "${_zmodules_zargs[@]}" -- _zimfw_run_tool && \
_zimfw_print -PR "Done with ${1}. Restart your terminal for any changes to take effect."
}
_zimfw_uninstall() {
local zopt
if (( _zprintlevel > 0 )) zopt=-v
@ -758,7 +764,7 @@ Options:
(( _zprintlevel-- ))
_zimfw_compile
;;
init) _zimfw_source_zimrc 2 && _zimfw_build ;;
init) _zimfw_install_update install && _zimfw_source_zimrc 2 && _zimfw_build ;;
clean) _zimfw_source_zimrc 2 && _zimfw_clean_compiled && _zimfw_clean_dumpfile ;;
clean-compiled) _zimfw_source_zimrc 2 && _zimfw_clean_compiled ;;
clean-dumpfile) _zimfw_clean_dumpfile ;;
@ -770,9 +776,7 @@ Options:
_zimfw_list_unuseds ' (unused)'
;;
install|update)
_zimfw_source_zimrc 1 ${1} && \
zargs -n 9 -P 0 -- "${_zmodules_zargs[@]}" -- _zimfw_run_tool && \
_zimfw_print -PR "Done with ${1}. Restart your terminal for any changes to take effect." || return 1
_zimfw_install_update ${1} || return 1
(( _zprintlevel-- ))
_zimfw_source_zimrc 2 && _zimfw_build && _zimfw_compile
;;