Revert "Further improve check-dumpfile action accuracy"
This reverts commit e47eaae2e4
.
This commit is contained in:
parent
e47eaae2e4
commit
d10d7c627c
4 changed files with 25 additions and 57 deletions
|
@ -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'
|
||||||
|
|
|
@ -1,34 +1,19 @@
|
||||||
_zimfw_check_dumpfile() {
|
_zimfw_check_dumpfile() {
|
||||||
local zdumpfile
|
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
|
||||||
local -i zup_to_date=-1
|
if (( ${+_zim_dumpfile_fpath} )); then
|
||||||
local zline
|
local -r zcomps=(${^_zim_dumpfile_fpath}/^([^_]*|*~|*.zwc(|.old))(N:t))
|
||||||
IFS=$' \t' read -rA zline < ${zdumpfile} || return 1
|
IFS=$' \t' read -rA zline < ${zdumpfile} || return 1
|
||||||
if [[ ${zline[4]} != ${ZSH_VERSION} ]] zup_to_date=0
|
if [[ ${zline[2]} -eq ${#zcomps} && ${zline[4]} == ${ZSH_VERSION} ]]; then
|
||||||
if (( zup_to_date != 0 && ${+_zim_fpath} )); then
|
_zimfw_print -PR "<%= okay %>%B${zdumpfile}:%b Already up to date"
|
||||||
local -r zold_zim_comps=(${^_zim_fpath}/^([^_]*|*~|*.zwc(|.old))(N:t))
|
|
||||||
local -r zpre=$'*\0'
|
|
||||||
local -r znew_zim_fpath=(${${_zfpaths#${~zpre}}:A})
|
|
||||||
local -r znew_zim_comps=(${^znew_zim_fpath}/^([^_]*|*~|*.zwc(|.old))(N:t))
|
|
||||||
if (( ${#zold_zim_comps} != ${#znew_zim_comps} )) zup_to_date=0
|
|
||||||
fi
|
|
||||||
if (( zup_to_date != 0 && ${+_zim_dumpfile_fpath} )); then
|
|
||||||
local -r znew_dumpfile_comps=(${^_zim_dumpfile_fpath}/^([^_]*|*~|*.zwc(|.old))(N:t))
|
|
||||||
if (( ${zline[2]} == ${#znew_dumpfile_comps} )); then
|
|
||||||
zup_to_date=1
|
|
||||||
else
|
else
|
||||||
zup_to_date=0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
case ${zup_to_date} in
|
|
||||||
-1) _zimfw_print -u2 -PR "%F{yellow}<%= warn %>%B${zdumpfile}:%b Unable to check. Initialize the completion module first." ;;
|
|
||||||
1) _zimfw_print -PR "<%= okay %>%B${zdumpfile}:%b Already up to date" ;;
|
|
||||||
0)
|
|
||||||
_zimfw_print -PR "<%= okay %>%B${zdumpfile}:%b New completion configuration needs to be dumped. Will do %Bclean-dumpfile%b."
|
_zimfw_print -PR "<%= okay %>%B${zdumpfile}:%b New completion configuration needs to be dumped. Will do %Bclean-dumpfile%b."
|
||||||
_zimfw_clean_dumpfile
|
_zimfw_clean_dumpfile
|
||||||
;;
|
fi
|
||||||
esac
|
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
|
else
|
||||||
_zimfw_print -PR "<%= okay %>%B${zdumpfile}:%b Not found"
|
_zimfw_print -PR "<%= okay %>%B${zdumpfile}:%b Not found"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -4,7 +4,7 @@ class Zim
|
||||||
:clear_line, :ellipsis, :okay, :warn, :error, :done, :failed
|
:clear_line, :ellipsis, :okay, :warn, :error, :done, :failed
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@version = "1.11.2-SNAPSHOT"
|
@version = "1.11.1"
|
||||||
@home = "${ZDOTDIR:-${HOME}}"
|
@home = "${ZDOTDIR:-${HOME}}"
|
||||||
@min_zsh_version = "5.2"
|
@min_zsh_version = "5.2"
|
||||||
# Matches {ssh,http,https,git}://{user@,}host/org/repo and {user@,}host:org/repo
|
# Matches {ssh,http,https,git}://{user@,}host/org/repo and {user@,}host:org/repo
|
||||||
|
|
42
zimfw.zsh
42
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'
|
||||||
|
@ -403,36 +402,21 @@ _zimfw_version_check() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_zimfw_check_dumpfile() {
|
_zimfw_check_dumpfile() {
|
||||||
local zdumpfile
|
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
|
||||||
local -i zup_to_date=-1
|
if (( ${+_zim_dumpfile_fpath} )); then
|
||||||
local zline
|
local -r zcomps=(${^_zim_dumpfile_fpath}/^([^_]*|*~|*.zwc(|.old))(N:t))
|
||||||
IFS=$' \t' read -rA zline < ${zdumpfile} || return 1
|
IFS=$' \t' read -rA zline < ${zdumpfile} || return 1
|
||||||
if [[ ${zline[4]} != ${ZSH_VERSION} ]] zup_to_date=0
|
if [[ ${zline[2]} -eq ${#zcomps} && ${zline[4]} == ${ZSH_VERSION} ]]; then
|
||||||
if (( zup_to_date != 0 && ${+_zim_fpath} )); then
|
_zimfw_print -PR "%F{green})%f %B${zdumpfile}:%b Already up to date"
|
||||||
local -r zold_zim_comps=(${^_zim_fpath}/^([^_]*|*~|*.zwc(|.old))(N:t))
|
|
||||||
local -r zpre=$'*\0'
|
|
||||||
local -r znew_zim_fpath=(${${_zfpaths#${~zpre}}:A})
|
|
||||||
local -r znew_zim_comps=(${^znew_zim_fpath}/^([^_]*|*~|*.zwc(|.old))(N:t))
|
|
||||||
if (( ${#zold_zim_comps} != ${#znew_zim_comps} )) zup_to_date=0
|
|
||||||
fi
|
|
||||||
if (( zup_to_date != 0 && ${+_zim_dumpfile_fpath} )); then
|
|
||||||
local -r znew_dumpfile_comps=(${^_zim_dumpfile_fpath}/^([^_]*|*~|*.zwc(|.old))(N:t))
|
|
||||||
if (( ${zline[2]} == ${#znew_dumpfile_comps} )); then
|
|
||||||
zup_to_date=1
|
|
||||||
else
|
else
|
||||||
zup_to_date=0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
case ${zup_to_date} in
|
|
||||||
-1) _zimfw_print -u2 -PR "%F{yellow}! %B${zdumpfile}:%b Unable to check. Initialize the completion module first." ;;
|
|
||||||
1) _zimfw_print -PR "%F{green})%f %B${zdumpfile}:%b Already up to date" ;;
|
|
||||||
0)
|
|
||||||
_zimfw_print -PR "%F{green})%f %B${zdumpfile}:%b New completion configuration needs to be dumped. Will do %Bclean-dumpfile%b."
|
_zimfw_print -PR "%F{green})%f %B${zdumpfile}:%b New completion configuration needs to be dumped. Will do %Bclean-dumpfile%b."
|
||||||
_zimfw_clean_dumpfile
|
_zimfw_clean_dumpfile
|
||||||
;;
|
fi
|
||||||
esac
|
else
|
||||||
|
_zimfw_print -u2 -PR "%F{yellow}! %B${zdumpfile}:%b Unable to check. This only works when the completion module is initialized."
|
||||||
|
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"
|
||||||
fi
|
fi
|
||||||
|
@ -470,7 +454,7 @@ _zimfw_compile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_zimfw_info() {
|
_zimfw_info() {
|
||||||
print -R 'zimfw version: '${_zversion}' (built at 2023-02-07 00:18:49 UTC, previous commit is 0516435)'
|
print -R 'zimfw version: '${_zversion}' (built at 2023-02-04 14:46:47 UTC, previous commit is 7778e97)'
|
||||||
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}
|
||||||
|
@ -857,7 +841,7 @@ esac
|
||||||
|
|
||||||
zimfw() {
|
zimfw() {
|
||||||
builtin emulate -L zsh -o EXTENDED_GLOB
|
builtin emulate -L zsh -o EXTENDED_GLOB
|
||||||
local -r _zversion='1.11.2-SNAPSHOT' zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b]
|
local -r _zversion='1.11.1' zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b]
|
||||||
|
|
||||||
Actions:
|
Actions:
|
||||||
%Bbuild%b Build %B${ZIM_HOME}/init.zsh%b and %B${ZIM_HOME}/login_init.zsh%b.
|
%Bbuild%b Build %B${ZIM_HOME}/init.zsh%b and %B${ZIM_HOME}/login_init.zsh%b.
|
||||||
|
|
Loading…
Reference in a new issue