Compare commits

...

3 Commits

Author SHA1 Message Date
Eric Nielsen fff151be09
v1.11.2 2023-02-16 07:59:49 -05:00
Eric Nielsen f71bff5418
Quote path names in init.zsh
to properly handle path names with spaces.
Fixes #497
2023-02-16 07:51:30 -05:00
Eric Nielsen d10d7c627c
Revert "Further improve check-dumpfile action accuracy"
This reverts commit e47eaae2e4.
2023-02-16 07:51:30 -05:00
7 changed files with 47 additions and 72 deletions

View File

@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
_No unreleased changes._
## [1.11.2] - 2023-02-16
### Fixed
- Quote path names in init.zsh to properly handle path names with spaces.
## [1.11.1] - 2023-02-04
### Fixed
@ -322,7 +328,8 @@ Take your time to review the updated [README.md] and the changes listed below.
[termtitle]: https://github.com/zimfw/termtitle
[s1ck94]: https://github.com/zimfw/s1ck94
[Unreleased]: https://github.com/zimfw/zimfw/compare/v1.11.1...HEAD
[Unreleased]: https://github.com/zimfw/zimfw/compare/v1.11.2...HEAD
[1.11.2]: https://github.com/zimfw/zimfw/compare/v1.11.1...v1.11.2
[1.11.1]: https://github.com/zimfw/zimfw/compare/v1.11.0...v1.11.1
[1.11.0]: https://github.com/zimfw/zimfw/compare/v1.10.0...v1.11.0
[1.10.0]: https://github.com/zimfw/zimfw/compare/v1.9.1...v1.10.0

View File

@ -5,8 +5,8 @@ _zimfw_build_init() {
command mv -f ${ztarget}{,.old} || return 1
fi
_zimfw_mv =(
print -R "zimfw() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }"
print -R "zmodule() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }"
print -R "zimfw() { source ${(q-)ZIM_HOME}/zimfw.zsh \"\${@}\" }"
print -R "zmodule() { source ${(q-)ZIM_HOME}/zimfw.zsh \"\${@}\" }"
local zroot_dir zpre
local -a zif_functions zif_cmds zroot_functions zroot_cmds
local -a zfunctions=(${_zfunctions}) zcmds=(${_zcmds})
@ -22,8 +22,7 @@ _zimfw_build_init() {
fi
done
zpre=$'*\0'
print -R 'typeset -gr _zim_fpath=('${${_zfpaths#${~zpre}}:A}')'
if (( ${#_zfpaths} )) print 'fpath=(${_zim_fpath} ${fpath})'
if (( ${#_zfpaths} )) print 'fpath=('${(q-)${_zfpaths#${~zpre}}:A}' ${fpath})'
if (( ${#zfunctions} )) print -R 'autoload -Uz -- '${zfunctions#${~zpre}}
for zroot_dir in ${_zroot_dirs}; do
zpre=${zroot_dir}$'\0'

View File

@ -179,11 +179,11 @@ Per-call initialization options:
shift
zarg=${1}
if [[ ${zarg} != /* ]] zarg=${zroot_dir}/${zarg}
zcmds+=("source ${zarg:A}")
zcmds+=("source ${(q-)zarg:A}")
;;
-c|--cmd)
shift
zcmds+=(${1//{}/${zroot_dir:A}})
zcmds+=(${1//{}/${(q-)zroot_dir:A}})
;;
-d|--disabled) _zdisabled_root_dirs+=(${zroot_dir}) ;;
*)
@ -211,11 +211,11 @@ Per-call initialization options:
local -ra prezto_scripts=(${zroot_dir}/init.zsh(N))
if (( ${#zfpaths} && ${#prezto_scripts} )); then
# this follows the prezto module format, no need to check for other scripts
zcmds=('source '${^prezto_scripts:A})
zcmds=('source '${(q-)^prezto_scripts:A})
else
# get script with largest size (descending `O`rder by `L`ength, and return only `[1]` first)
local -ra zscripts=(${zroot_dir}/(init.zsh|(${zname:t}|${zroot_dir:t}).(zsh|plugin.zsh|zsh-theme|sh))(NOL[1]))
zcmds=('source '${^zscripts:A})
zcmds=('source '${(q-)^zscripts:A})
fi
fi
if (( ! ${#zfpaths} && ! ${#zfunctions} && ! ${#zcmds} )); then

View File

@ -1,34 +1,19 @@
_zimfw_check_dumpfile() {
local zdumpfile
local zdumpfile zfpath zline
zstyle -s ':zim:completion' dumpfile 'zdumpfile' || zdumpfile=<%= home %>/.zcompdump
if [[ -e ${zdumpfile} ]]; then
local -i zup_to_date=-1
local zline
IFS=$' \t' read -rA zline < ${zdumpfile} || return 1
if [[ ${zline[4]} != ${ZSH_VERSION} ]] zup_to_date=0
if (( zup_to_date != 0 && ${+_zim_fpath} )); then
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
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
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_clean_dumpfile
;;
esac
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

View File

@ -1,7 +1,7 @@
# This runs in a new shell
builtin emulate -L zsh -o EXTENDED_GLOB
readonly -i PRINTLEVEL=${1} SUBMODULES=${8}
readonly ACTION=${2} MODULE=${3} DIR=${4} URL=${5} REV=${7} ONPULL=${9} TEMP=.zdegit_${RANDOM}
readonly ACTION=${2} MODULE=${3} DIR=${4} URL=${5} REV=${7} ONPULL=${9} TEMP=.zdegit_${sysparams[pid]}
readonly TARBALL_TARGET=${DIR}/${TEMP}_tarball.tar.gz INFO_TARGET=${DIR}/.zdegit
print_error() {

View File

@ -4,7 +4,7 @@ class Zim
:clear_line, :ellipsis, :okay, :warn, :error, :done, :failed
def initialize
@version = "1.11.2-SNAPSHOT"
@version = "1.11.2"
@home = "${ZDOTDIR:-${HOME}}"
@min_zsh_version = "5.2"
# Matches {ssh,http,https,git}://{user@,}host/org/repo and {user@,}host:org/repo

View File

@ -57,8 +57,8 @@ _zimfw_build_init() {
command mv -f ${ztarget}{,.old} || return 1
fi
_zimfw_mv =(
print -R "zimfw() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }"
print -R "zmodule() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }"
print -R "zimfw() { source ${(q-)ZIM_HOME}/zimfw.zsh \"\${@}\" }"
print -R "zmodule() { source ${(q-)ZIM_HOME}/zimfw.zsh \"\${@}\" }"
local zroot_dir zpre
local -a zif_functions zif_cmds zroot_functions zroot_cmds
local -a zfunctions=(${_zfunctions}) zcmds=(${_zcmds})
@ -74,8 +74,7 @@ _zimfw_build_init() {
fi
done
zpre=$'*\0'
print -R 'typeset -gr _zim_fpath=('${${_zfpaths#${~zpre}}:A}')'
if (( ${#_zfpaths} )) print 'fpath=(${_zim_fpath} ${fpath})'
if (( ${#_zfpaths} )) print 'fpath=('${(q-)${_zfpaths#${~zpre}}:A}' ${fpath})'
if (( ${#zfunctions} )) print -R 'autoload -Uz -- '${zfunctions#${~zpre}}
for zroot_dir in ${_zroot_dirs}; do
zpre=${zroot_dir}$'\0'
@ -293,11 +292,11 @@ Per-call initialization options:
shift
zarg=${1}
if [[ ${zarg} != /* ]] zarg=${zroot_dir}/${zarg}
zcmds+=("source ${zarg:A}")
zcmds+=("source ${(q-)zarg:A}")
;;
-c|--cmd)
shift
zcmds+=(${1//{}/${zroot_dir:A}})
zcmds+=(${1//{}/${(q-)zroot_dir:A}})
;;
-d|--disabled) _zdisabled_root_dirs+=(${zroot_dir}) ;;
*)
@ -325,11 +324,11 @@ Per-call initialization options:
local -ra prezto_scripts=(${zroot_dir}/init.zsh(N))
if (( ${#zfpaths} && ${#prezto_scripts} )); then
# this follows the prezto module format, no need to check for other scripts
zcmds=('source '${^prezto_scripts:A})
zcmds=('source '${(q-)^prezto_scripts:A})
else
# get script with largest size (descending `O`rder by `L`ength, and return only `[1]` first)
local -ra zscripts=(${zroot_dir}/(init.zsh|(${zname:t}|${zroot_dir:t}).(zsh|plugin.zsh|zsh-theme|sh))(NOL[1]))
zcmds=('source '${^zscripts:A})
zcmds=('source '${(q-)^zscripts:A})
fi
fi
if (( ! ${#zfpaths} && ! ${#zfunctions} && ! ${#zcmds} )); then
@ -403,36 +402,21 @@ _zimfw_version_check() {
}
_zimfw_check_dumpfile() {
local zdumpfile
local zdumpfile zfpath zline
zstyle -s ':zim:completion' dumpfile 'zdumpfile' || zdumpfile=${ZDOTDIR:-${HOME}}/.zcompdump
if [[ -e ${zdumpfile} ]]; then
local -i zup_to_date=-1
local zline
IFS=$' \t' read -rA zline < ${zdumpfile} || return 1
if [[ ${zline[4]} != ${ZSH_VERSION} ]] zup_to_date=0
if (( zup_to_date != 0 && ${+_zim_fpath} )); then
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
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 "%F{green})%f %B${zdumpfile}:%b Already up to date"
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_clean_dumpfile
;;
esac
fi
else
_zimfw_print -u2 -PR "%F{yellow}! %B${zdumpfile}:%b Unable to check. This only works when the completion module is initialized."
fi
else
_zimfw_print -PR "%F{green})%f %B${zdumpfile}:%b Not found"
fi
@ -470,7 +454,7 @@ _zimfw_compile() {
}
_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-16 12:53:12 UTC, previous commit is f71bff5)'
print -R 'OSTYPE: '${OSTYPE}
print -R 'TERM: '${TERM}
print -R 'TERM_PROGRAM: '${TERM_PROGRAM}
@ -600,7 +584,7 @@ _zimfw_run_tool() {
degit) zcmd="# This runs in a new shell
builtin emulate -L zsh -o EXTENDED_GLOB
readonly -i PRINTLEVEL=\${1} SUBMODULES=\${8}
readonly ACTION=\${2} MODULE=\${3} DIR=\${4} URL=\${5} REV=\${7} ONPULL=\${9} TEMP=.zdegit_\${RANDOM}
readonly ACTION=\${2} MODULE=\${3} DIR=\${4} URL=\${5} REV=\${7} ONPULL=\${9} TEMP=.zdegit_\${sysparams[pid]}
readonly TARBALL_TARGET=\${DIR}/\${TEMP}_tarball.tar.gz INFO_TARGET=\${DIR}/.zdegit
print_error() {
@ -857,7 +841,7 @@ esac
zimfw() {
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.2' zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b]
Actions:
%Bbuild%b Build %B${ZIM_HOME}/init.zsh%b and %B${ZIM_HOME}/login_init.zsh%b.