Use --sort=-v:refname
in _zimfw_check_version
to sort tags, instead of using Zsh's `(On)`. The tags will come sorted already.
This commit is contained in:
parent
e0d067977c
commit
d33d632ec1
3 changed files with 9 additions and 13 deletions
|
@ -1,18 +1,16 @@
|
||||||
_zimfw_check_version() {
|
_zimfw_check_version() {
|
||||||
if (( ${1} )); then
|
if (( ${1} )); then
|
||||||
# Get latest version (get all `v*` tags from repo, delete `*v` from beginning,
|
|
||||||
# sort in descending `O`rder `n`umerically, and get the `[1]` first)
|
|
||||||
if (( ${2} )); then
|
if (( ${2} )); then
|
||||||
# background check
|
# background check
|
||||||
if [[ -w ${_zversion_target:h} ]]; then
|
if [[ -w ${_zversion_target:h} ]]; then
|
||||||
print -R ${${(On)${(f)"$(GIT_HTTP_LOW_SPEED_LIMIT=1000 GIT_HTTP_LOW_SPEED_TIME=30 command git ls-remote --tags --refs \
|
print -R ${${${(f)"$(GIT_HTTP_LOW_SPEED_LIMIT=1000 GIT_HTTP_LOW_SPEED_TIME=30 command git ls-remote --tags --refs --sort=-v:refname \
|
||||||
https://github.com/zimfw/zimfw.git 'v*' 2>/dev/null)"}##*v}[1]} >! ${_zversion_target} &!
|
https://github.com/zimfw/zimfw.git 'v*' 2>/dev/null)"}##*v}[1]} >! ${_zversion_target} &!
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# foreground check
|
# foreground check
|
||||||
local tags
|
local tags
|
||||||
tags=$(command git ls-remote --tags --refs https://github.com/zimfw/zimfw.git 'v*') || return 1
|
tags=$(command git ls-remote --tags --refs --sort=-v:refname https://github.com/zimfw/zimfw.git 'v*') || return 1
|
||||||
>! ${_zversion_target} <<<${${(On)${(f)tags}##*v}[1]} || return 1
|
>! ${_zversion_target} <<<${${${(f)tags}##*v}[1]} || return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ -f ${_zversion_target} ]]; then
|
if [[ -f ${_zversion_target} ]]; then
|
||||||
|
|
|
@ -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.12.0"
|
@version = "1.12.1-SNAPSHOT"
|
||||||
@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
|
||||||
|
|
12
zimfw.zsh
12
zimfw.zsh
|
@ -387,19 +387,17 @@ _zimfw_check_dumpfile() {
|
||||||
|
|
||||||
_zimfw_check_version() {
|
_zimfw_check_version() {
|
||||||
if (( ${1} )); then
|
if (( ${1} )); then
|
||||||
# Get latest version (get all `v*` tags from repo, delete `*v` from beginning,
|
|
||||||
# sort in descending `O`rder `n`umerically, and get the `[1]` first)
|
|
||||||
if (( ${2} )); then
|
if (( ${2} )); then
|
||||||
# background check
|
# background check
|
||||||
if [[ -w ${_zversion_target:h} ]]; then
|
if [[ -w ${_zversion_target:h} ]]; then
|
||||||
print -R ${${(On)${(f)"$(GIT_HTTP_LOW_SPEED_LIMIT=1000 GIT_HTTP_LOW_SPEED_TIME=30 command git ls-remote --tags --refs \
|
print -R ${${${(f)"$(GIT_HTTP_LOW_SPEED_LIMIT=1000 GIT_HTTP_LOW_SPEED_TIME=30 command git ls-remote --tags --refs --sort=-v:refname \
|
||||||
https://github.com/zimfw/zimfw.git 'v*' 2>/dev/null)"}##*v}[1]} >! ${_zversion_target} &!
|
https://github.com/zimfw/zimfw.git 'v*' 2>/dev/null)"}##*v}[1]} >! ${_zversion_target} &!
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# foreground check
|
# foreground check
|
||||||
local tags
|
local tags
|
||||||
tags=$(command git ls-remote --tags --refs https://github.com/zimfw/zimfw.git 'v*') || return 1
|
tags=$(command git ls-remote --tags --refs --sort=-v:refname https://github.com/zimfw/zimfw.git 'v*') || return 1
|
||||||
>! ${_zversion_target} <<<${${(On)${(f)tags}##*v}[1]} || return 1
|
>! ${_zversion_target} <<<${${${(f)tags}##*v}[1]} || return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ -f ${_zversion_target} ]]; then
|
if [[ -f ${_zversion_target} ]]; then
|
||||||
|
@ -446,7 +444,7 @@ _zimfw_compile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_zimfw_info() {
|
_zimfw_info() {
|
||||||
print -R 'zimfw version: '${_zversion}' (built at 2023-07-17 23:54:58 UTC, previous commit is 49386ca)'
|
print -R 'zimfw version: '${_zversion}' (built at 2023-09-16 00:51:35 UTC, previous commit is e0d0679)'
|
||||||
local zparam
|
local zparam
|
||||||
for zparam in LANG ${(Mk)parameters:#LC_*} OSTYPE TERM TERM_PROGRAM TERM_PROGRAM_VERSION ZIM_HOME ZSH_VERSION; do
|
for zparam in LANG ${(Mk)parameters:#LC_*} OSTYPE TERM TERM_PROGRAM TERM_PROGRAM_VERSION ZIM_HOME ZSH_VERSION; do
|
||||||
print -R ${(r.22....:.)zparam}${(P)zparam}
|
print -R ${(r.22....:.)zparam}${(P)zparam}
|
||||||
|
@ -847,7 +845,7 @@ _zimfw_run_tool_action() {
|
||||||
|
|
||||||
zimfw() {
|
zimfw() {
|
||||||
builtin emulate -L zsh -o EXTENDED_GLOB
|
builtin emulate -L zsh -o EXTENDED_GLOB
|
||||||
local -r _zversion='1.12.0' _zversion_target=${ZIM_HOME}/.latest_version zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b]
|
local -r _zversion='1.12.1-SNAPSHOT' _zversion_target=${ZIM_HOME}/.latest_version 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