More accurate check-dumpfile action
by using the `_zim_dumpfile_fpath` variable set by the completion module
[here](33737e8c15/init.zsh (L11)
)
right before `compinit` is run.
This commit is contained in:
parent
281cde57f7
commit
a434fda508
4 changed files with 28 additions and 30 deletions
|
@ -7,7 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
_No unreleased changes._
|
### Fixed
|
||||||
|
|
||||||
|
- Use `_zim_dumpfile_fpath` defined by the completion module
|
||||||
|
[here](https://github.com/zimfw/completion/blob/33737e8c15fa8dba9af47bef8408b1af2599c21b/init.zsh#L11),
|
||||||
|
right before `compinit` is run, to more accurately do `zimfw check-dumpfile`.
|
||||||
|
|
||||||
## [1.11.0] - 2022-12-18
|
## [1.11.0] - 2022-12-18
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,7 @@ _zimfw_build_init() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
zpre=$'*\0'
|
zpre=$'*\0'
|
||||||
print -R 'typeset -gr _zim_fpath=('${${_zfpaths#${~zpre}}:A}')'
|
if (( ${#_zfpaths} )) print 'fpath=('${${_zfpaths#${~zpre}}:A}' ${fpath})'
|
||||||
if (( ${#_zfpaths} )) print 'fpath=(${_zim_fpath} ${fpath})'
|
|
||||||
if (( ${#zfunctions} )) print -R 'autoload -Uz -- '${zfunctions#${~zpre}}
|
if (( ${#zfunctions} )) print -R 'autoload -Uz -- '${zfunctions#${~zpre}}
|
||||||
for zroot_dir in ${_zroot_dirs}; do
|
for zroot_dir in ${_zroot_dirs}; do
|
||||||
zpre=${zroot_dir}$'\0'
|
zpre=${zroot_dir}$'\0'
|
||||||
|
|
|
@ -2,19 +2,17 @@ _zimfw_check_dumpfile() {
|
||||||
local zdumpfile zfpath zline
|
local zdumpfile zfpath zline
|
||||||
zstyle -s ':zim:completion' dumpfile 'zdumpfile' || zdumpfile=<%= home %>/.zcompdump
|
zstyle -s ':zim:completion' dumpfile 'zdumpfile' || zdumpfile=<%= home %>/.zcompdump
|
||||||
if [[ -e ${zdumpfile} ]]; then
|
if [[ -e ${zdumpfile} ]]; then
|
||||||
if (( ${+_zim_fpath} )); then
|
if (( ${+_zim_dumpfile_fpath} )); then
|
||||||
local -r zpre=$'*\0'
|
local -r zcomps=(${^_zim_dumpfile_fpath}/^([^_]*|*~|*.zwc(|.old))(N:t))
|
||||||
zfpath=(${${_zfpaths#${~zpre}}:A} ${fpath:|_zim_fpath})
|
IFS=$' \t' read -rA zline < ${zdumpfile} || return 1
|
||||||
|
if [[ ${zline[2]} -eq ${#zcomps} && ${zline[4]} == ${ZSH_VERSION} ]]; then
|
||||||
|
_zimfw_print -PR "<%= okay %>%B${zdumpfile}:%b Already up to date"
|
||||||
|
else
|
||||||
|
_zimfw_print -PR "<%= okay %>%B${zdumpfile}:%b New completion configuration needs to be dumped. Will do %Bclean-dumpfile%b."
|
||||||
|
_zimfw_clean_dumpfile
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
zfpath=(${fpath})
|
_zimfw_print -u2 -PR "%F{yellow}<%= warn %>%B${zdumpfile}:%b Unable to check. This only works when the completion module is initialized."
|
||||||
fi
|
|
||||||
local -r zcomps=(${^zfpath}/^([^_]*|*~|*.zwc(|.old))(N:t))
|
|
||||||
IFS=$' \t' read -rA zline < ${zdumpfile} || return 1
|
|
||||||
if [[ ${zline[2]} -eq ${#zcomps} && ${zline[4]} == ${ZSH_VERSION} ]]; then
|
|
||||||
_zimfw_print -PR "<%= okay %>%B${zdumpfile}:%b Already up to date"
|
|
||||||
else
|
|
||||||
_zimfw_print -PR "<%= okay %>%B${zdumpfile}:%b New completion configuration needs to be dumped. Will do %Bclean-dumpfile%b."
|
|
||||||
_zimfw_clean_dumpfile
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
_zimfw_print -PR "<%= okay %>%B${zdumpfile}:%b Not found"
|
_zimfw_print -PR "<%= okay %>%B${zdumpfile}:%b Not found"
|
||||||
|
|
27
zimfw.zsh
27
zimfw.zsh
|
@ -74,8 +74,7 @@ _zimfw_build_init() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
zpre=$'*\0'
|
zpre=$'*\0'
|
||||||
print -R 'typeset -gr _zim_fpath=('${${_zfpaths#${~zpre}}:A}')'
|
if (( ${#_zfpaths} )) print 'fpath=('${${_zfpaths#${~zpre}}:A}' ${fpath})'
|
||||||
if (( ${#_zfpaths} )) print 'fpath=(${_zim_fpath} ${fpath})'
|
|
||||||
if (( ${#zfunctions} )) print -R 'autoload -Uz -- '${zfunctions#${~zpre}}
|
if (( ${#zfunctions} )) print -R 'autoload -Uz -- '${zfunctions#${~zpre}}
|
||||||
for zroot_dir in ${_zroot_dirs}; do
|
for zroot_dir in ${_zroot_dirs}; do
|
||||||
zpre=${zroot_dir}$'\0'
|
zpre=${zroot_dir}$'\0'
|
||||||
|
@ -406,19 +405,17 @@ _zimfw_check_dumpfile() {
|
||||||
local zdumpfile zfpath zline
|
local zdumpfile zfpath zline
|
||||||
zstyle -s ':zim:completion' dumpfile 'zdumpfile' || zdumpfile=${ZDOTDIR:-${HOME}}/.zcompdump
|
zstyle -s ':zim:completion' dumpfile 'zdumpfile' || zdumpfile=${ZDOTDIR:-${HOME}}/.zcompdump
|
||||||
if [[ -e ${zdumpfile} ]]; then
|
if [[ -e ${zdumpfile} ]]; then
|
||||||
if (( ${+_zim_fpath} )); then
|
if (( ${+_zim_dumpfile_fpath} )); then
|
||||||
local -r zpre=$'*\0'
|
local -r zcomps=(${^_zim_dumpfile_fpath}/^([^_]*|*~|*.zwc(|.old))(N:t))
|
||||||
zfpath=(${${_zfpaths#${~zpre}}:A} ${fpath:|_zim_fpath})
|
IFS=$' \t' read -rA zline < ${zdumpfile} || return 1
|
||||||
|
if [[ ${zline[2]} -eq ${#zcomps} && ${zline[4]} == ${ZSH_VERSION} ]]; then
|
||||||
|
_zimfw_print -PR "%F{green})%f %B${zdumpfile}:%b Already up to date"
|
||||||
|
else
|
||||||
|
_zimfw_print -PR "%F{green})%f %B${zdumpfile}:%b New completion configuration needs to be dumped. Will do %Bclean-dumpfile%b."
|
||||||
|
_zimfw_clean_dumpfile
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
zfpath=(${fpath})
|
_zimfw_print -u2 -PR "%F{yellow}! %B${zdumpfile}:%b Unable to check. This only works when the completion module is initialized."
|
||||||
fi
|
|
||||||
local -r zcomps=(${^zfpath}/^([^_]*|*~|*.zwc(|.old))(N:t))
|
|
||||||
IFS=$' \t' read -rA zline < ${zdumpfile} || return 1
|
|
||||||
if [[ ${zline[2]} -eq ${#zcomps} && ${zline[4]} == ${ZSH_VERSION} ]]; then
|
|
||||||
_zimfw_print -PR "%F{green})%f %B${zdumpfile}:%b Already up to date"
|
|
||||||
else
|
|
||||||
_zimfw_print -PR "%F{green})%f %B${zdumpfile}:%b New completion configuration needs to be dumped. Will do %Bclean-dumpfile%b."
|
|
||||||
_zimfw_clean_dumpfile
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
_zimfw_print -PR "%F{green})%f %B${zdumpfile}:%b Not found"
|
_zimfw_print -PR "%F{green})%f %B${zdumpfile}:%b Not found"
|
||||||
|
@ -457,7 +454,7 @@ _zimfw_compile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_zimfw_info() {
|
_zimfw_info() {
|
||||||
print -R 'zimfw version: '${_zversion}' (built at 2022-12-18 21:05:25 UTC, previous commit is e54958b)'
|
print -R 'zimfw version: '${_zversion}' (built at 2023-02-03 23:52:16 UTC, previous commit is 281cde5)'
|
||||||
print -R 'OSTYPE: '${OSTYPE}
|
print -R 'OSTYPE: '${OSTYPE}
|
||||||
print -R 'TERM: '${TERM}
|
print -R 'TERM: '${TERM}
|
||||||
print -R 'TERM_PROGRAM: '${TERM_PROGRAM}
|
print -R 'TERM_PROGRAM: '${TERM_PROGRAM}
|
||||||
|
|
Loading…
Reference in a new issue