1
0
Fork 0
mirror of synced 2024-12-04 13:05:34 -05:00

Compare commits

...

2 commits

Author SHA1 Message Date
Eric Nielsen
f51b548e9e
Also list not installed modules with list action
when not in verbose mode. Still fail in this case in verbose mode
because zmodule needs to eagerly inspect the module files.
2024-11-27 19:04:09 -05:00
Eric Nielsen
e9279aaa53
Use just one flag when zmodule should be eager
and then assume that the module is already installed. Was using bitwise
flags before, which was unnecessarily complex.
2024-11-27 18:42:58 -05:00
8 changed files with 30 additions and 28 deletions

View file

@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
_No unreleased changes._
### Added
- Also list not installed modules with `list` action, when not in verbose mode.
## [1.16.0] - 2024-11-25

View file

@ -206,10 +206,8 @@ Per-call initialization options:
esac
shift
done
if (( _zflags & 1 )); then
_znames+=(${zname})
fi
if (( _zflags & 2 )); then
if (( _zeager )); then
if [[ ! -e ${zroot_dir} ]]; then
print -u2 -R "${_zerror}${funcfiletrace[1]}:${_zbold}${zname}: ${zroot_dir}${_znormalred} not found${_znormal}"
_zfailed=1

View file

@ -1,13 +1,13 @@
_zimfw_source_zimrc() {
<%= render_all("src/functions/*.erb") %>
{
local -r _zflags=${1}
local -ri _zeager=${1}
local -i _zfailed=0
if ! source ${_zconfig} || (( _zfailed )); then
print -u2 -R "${_zred}Failed to source ${_zbold}${_zconfig}${_znormal}"
return 1
fi
if (( _zflags & 1 && ${#_znames} == 0 )); then
if (( ${#_znames} == 0 )); then
print -u2 -R "${_zred}No modules defined in ${_zbold}${_zconfig}${_znormal}"
return 1
fi

View file

@ -2,6 +2,7 @@ _zimfw_run_list() {
local -r zname=${1}
local -r zdir=${_zdirs[${zname}]}
print -nR "${_zbold}${zname}:${_znormal} ${zdir}"
if [[ ! -e ${zdir} ]] print -n ' (not installed)'
if [[ -z ${_zurls[${zname}]} ]] print -n ' (external)'
if (( ${_zfrozens[${zname}]} )) print -n ' (frozen)'
if (( ${_zdisabled_root_dirs[(I)${zdir}]} )) print -n ' (disabled)'

View file

@ -1,7 +1,7 @@
_zimfw_run_tool_action() {
local -i zmaxprocs=0
if [[ ${1} == reinstall ]] zmaxprocs=1
_zimfw_source_zimrc 1 || return 1
_zimfw_source_zimrc 0 || return 1
zargs -n 2 -P ${zmaxprocs} -- "${_znames[@]}" -- _zimfw_run_tool ${1}
return 0
}

View file

@ -72,7 +72,7 @@ Options:
local _zrestartmsg=' Restart your terminal for changes to take effect.'
case ${1} in
build)
_zimfw_source_zimrc 2 && _zimfw_build || return 1
_zimfw_source_zimrc 1 && _zimfw_build || return 1
(( _zprintlevel-- ))
_zimfw_compile
;;
@ -84,7 +84,8 @@ Options:
help) print -R ${zusage} ;;
info) _zimfw_info ;;
list)
_zimfw_source_zimrc 3 && zargs -n 1 -- "${_znames[@]}" -- _zimfw_run_list && \
_zimfw_source_zimrc $(( _zprintlevel > 1 )) && \
zargs -n 1 -- "${_znames[@]}" -- _zimfw_run_list && \
_zimfw_list_unuseds ' (unused)'
;;
check)
@ -98,13 +99,13 @@ Options:
_zimfw_run_tool_action install || return 1
(( _zprintlevel-- ))
_zimfw_print 'Done with install.' # Only printed in verbose mode
_zimfw_source_zimrc 2 && _zimfw_build && _zimfw_compile
_zimfw_source_zimrc 1 && _zimfw_build && _zimfw_compile
;;
install|update|reinstall)
_zimfw_run_tool_action ${1} || return 1
_zimfw_print -R "Done with ${1}.${_zrestartmsg}"
(( _zprintlevel-- ))
_zimfw_source_zimrc 2 && _zimfw_build && _zimfw_compile
_zimfw_source_zimrc 1 && _zimfw_build && _zimfw_compile
;;
uninstall) _zimfw_source_zimrc 0 && _zimfw_list_unuseds && _zimfw_uninstall ;;
check-version) _zimfw_check_version 1 ;;

View file

@ -4,7 +4,7 @@ class Zim
:bold, :normal, :red, :normalred, :yellow, :normalyellow, :clear_line, :ellipsis, :okay, :warn, :error
def initialize
@version = "1.16.0"
@version = "1.17.0-SNAPSHOT"
@home = "${ZDOTDIR:-${HOME}}"
@min_zsh_version = "5.2"
# Matches {ssh,http,https,git}://{user@,}host/org/repo and {user@,}host:org/repo

View file

@ -325,10 +325,8 @@ Per-call initialization options:
esac
shift
done
if (( _zflags & 1 )); then
_znames+=(${zname})
fi
if (( _zflags & 2 )); then
if (( _zeager )); then
if [[ ! -e ${zroot_dir} ]]; then
print -u2 -R "${_zerror}${funcfiletrace[1]}:${_zbold}${zname}: ${zroot_dir}${_znormalred} not found${_znormal}"
_zfailed=1
@ -362,13 +360,13 @@ Per-call initialization options:
}
{
local -r _zflags=${1}
local -ri _zeager=${1}
local -i _zfailed=0
if ! source ${_zconfig} || (( _zfailed )); then
print -u2 -R "${_zred}Failed to source ${_zbold}${_zconfig}${_znormal}"
return 1
fi
if (( _zflags & 1 && ${#_znames} == 0 )); then
if (( ${#_znames} == 0 )); then
print -u2 -R "${_zred}No modules defined in ${_zbold}${_zconfig}${_znormal}"
return 1
fi
@ -470,7 +468,7 @@ _zimfw_info() {
_zimfw_info_print_symlink ZIM_HOME ${ZIM_HOME}
_zimfw_info_print_symlink 'zimfw config' ${_zconfig}
_zimfw_info_print_symlink 'zimfw script' ${__ZIMFW_FILE}
print -R 'zimfw version: '${_zversion}' (built at 2024-11-25 13:50:33 UTC, previous commit is 2d5718e)'
print -R 'zimfw version: '${_zversion}' (built at 2024-11-27 23:56:10 UTC, previous commit is e9279aa)'
local zparam
for zparam in LANG ${(Mk)parameters:#LC_*} OSTYPE TERM TERM_PROGRAM TERM_PROGRAM_VERSION ZSH_VERSION; do
print -R ${(r.22....:.)zparam}${(P)zparam}
@ -534,6 +532,7 @@ _zimfw_run_list() {
local -r zname=${1}
local -r zdir=${_zdirs[${zname}]}
print -nR "${_zbold}${zname}:${_znormal} ${zdir}"
if [[ ! -e ${zdir} ]] print -n ' (not installed)'
if [[ -z ${_zurls[${zname}]} ]] print -n ' (external)'
if (( ${_zfrozens[${zname}]} )) print -n ' (frozen)'
if (( ${_zdisabled_root_dirs[(I)${zdir}]} )) print -n ' (disabled)'
@ -952,7 +951,7 @@ _zimfw_run_tool() {
_zimfw_run_tool_action() {
local -i zmaxprocs=0
if [[ ${1} == reinstall ]] zmaxprocs=1
_zimfw_source_zimrc 1 || return 1
_zimfw_source_zimrc 0 || return 1
zargs -n 2 -P ${zmaxprocs} -- "${_znames[@]}" -- _zimfw_run_tool ${1}
return 0
}
@ -965,7 +964,7 @@ zimfw() {
local -r _znormal= _zbold= _zred= _znormalred= _zgreen= _zyellow= _znormalyellow=
fi
local -r _zerror="${_zred}x " _zokay="${_zgreen}) ${_znormal}" _zwarn="${_zyellow}! "
local -r _zconfig=${ZIM_CONFIG_FILE:-${ZDOTDIR:-${HOME}}/.zimrc} _zversion='1.16.0'
local -r _zconfig=${ZIM_CONFIG_FILE:-${ZDOTDIR:-${HOME}}/.zimrc} _zversion='1.17.0-SNAPSHOT'
local -r zusage="Usage: ${_zbold}${0}${_znormal} <action> [${_zbold}-q${_znormal}|${_zbold}-v${_znormal}]
Actions:
@ -1031,7 +1030,7 @@ Options:
local _zrestartmsg=' Restart your terminal for changes to take effect.'
case ${1} in
build)
_zimfw_source_zimrc 2 && _zimfw_build || return 1
_zimfw_source_zimrc 1 && _zimfw_build || return 1
(( _zprintlevel-- ))
_zimfw_compile
;;
@ -1043,7 +1042,8 @@ Options:
help) print -R ${zusage} ;;
info) _zimfw_info ;;
list)
_zimfw_source_zimrc 3 && zargs -n 1 -- "${_znames[@]}" -- _zimfw_run_list && \
_zimfw_source_zimrc $(( _zprintlevel > 1 )) && \
zargs -n 1 -- "${_znames[@]}" -- _zimfw_run_list && \
_zimfw_list_unuseds ' (unused)'
;;
check)
@ -1057,13 +1057,13 @@ Options:
_zimfw_run_tool_action install || return 1
(( _zprintlevel-- ))
_zimfw_print 'Done with install.' # Only printed in verbose mode
_zimfw_source_zimrc 2 && _zimfw_build && _zimfw_compile
_zimfw_source_zimrc 1 && _zimfw_build && _zimfw_compile
;;
install|update|reinstall)
_zimfw_run_tool_action ${1} || return 1
_zimfw_print -R "Done with ${1}.${_zrestartmsg}"
(( _zprintlevel-- ))
_zimfw_source_zimrc 2 && _zimfw_build && _zimfw_compile
_zimfw_source_zimrc 1 && _zimfw_build && _zimfw_compile
;;
uninstall) _zimfw_source_zimrc 0 && _zimfw_list_unuseds && _zimfw_uninstall ;;
check-version) _zimfw_check_version 1 ;;