a434fda508
by using the `_zim_dumpfile_fpath` variable set by the completion module
[here](33737e8c15/init.zsh (L11)
)
right before `compinit` is run.
22 lines
975 B
Plaintext
22 lines
975 B
Plaintext
_zimfw_check_dumpfile() {
|
|
local zdumpfile zfpath zline
|
|
zstyle -s ':zim:completion' dumpfile 'zdumpfile' || zdumpfile=<%= home %>/.zcompdump
|
|
if [[ -e ${zdumpfile} ]]; then
|
|
if (( ${+_zim_dumpfile_fpath} )); then
|
|
local -r zcomps=(${^_zim_dumpfile_fpath}/^([^_]*|*~|*.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
|
|
else
|
|
_zimfw_print -u2 -PR "%F{yellow}<%= warn %>%B${zdumpfile}:%b Unable to check. This only works when the completion module is initialized."
|
|
fi
|
|
else
|
|
_zimfw_print -PR "<%= okay %>%B${zdumpfile}:%b Not found"
|
|
fi
|
|
_zimfw_print 'Done with check-dumpfile.'
|
|
}
|