1
0
Fork 0
mirror of synced 2024-11-22 15:25:34 -05:00

Further clean up and simplify code

@startup_files_glob is not used anymore.
This commit is contained in:
Eric Nielsen 2022-01-11 11:29:47 -05:00
parent 2491856a7b
commit 92bfa96993
No known key found for this signature in database
GPG key ID: 47D1DBFA0765A1FB
4 changed files with 12 additions and 13 deletions

View file

@ -164,11 +164,11 @@ Initialization options:
local -ra prezto_scripts=(${zdir}/init.zsh(N)) local -ra prezto_scripts=(${zdir}/init.zsh(N))
if (( ${#zfpaths} && ${#prezto_scripts} )); then if (( ${#zfpaths} && ${#prezto_scripts} )); then
# this follows the prezto module format, no need to check for other scripts # this follows the prezto module format, no need to check for other scripts
zcmds=("source ${^prezto_scripts[@]:A}") zcmds=('source '${^prezto_scripts:A})
else else
# get script with largest size (descending `O`rder by `L`ength, and return only `[1]` first) # get script with largest size (descending `O`rder by `L`ength, and return only `[1]` first)
local -ra zscripts=(${zdir}/(init.zsh|${zmodule:t}.(zsh|plugin.zsh|zsh-theme|sh))(NOL[1])) local -ra zscripts=(${zdir}/(init.zsh|${zmodule:t}.(zsh|plugin.zsh|zsh-theme|sh))(NOL[1]))
zcmds=("source ${^zscripts[@]:A}") zcmds=('source '${^zscripts:A})
fi fi
fi fi
if (( ! ${#zfpaths} && ! ${#zfunctions} && ! ${#zcmds} )); then if (( ! ${#zfpaths} && ! ${#zfunctions} && ! ${#zcmds} )); then

View file

@ -19,8 +19,8 @@ _zimfw_run_list() {
# Match and remove the current module prefix from _zfpaths, _zfunctions and _zcmds # Match and remove the current module prefix from _zfpaths, _zfunctions and _zcmds
local -r zpre=${zmodule}$'\0' local -r zpre=${zmodule}$'\0'
local -r zfpaths=(${${(M)_zfpaths:#${zpre}*}#${zpre}}) zfunctions=(${${(M)_zfunctions:#${zpre}*}#${zpre}}) zcmds=(${${(M)_zcmds:#${zpre}*}#${zpre}}) local -r zfpaths=(${${(M)_zfpaths:#${zpre}*}#${zpre}}) zfunctions=(${${(M)_zfunctions:#${zpre}*}#${zpre}}) zcmds=(${${(M)_zcmds:#${zpre}*}#${zpre}})
if (( ${#zfpaths} )) print -R " fpath: ${zfpaths[@]}" if (( ${#zfpaths} )) print -R ' fpath: '${zfpaths}
if (( ${#zfunctions} )) print -R " autoload: ${zfunctions[@]}" if (( ${#zfunctions} )) print -R ' autoload: '${zfunctions}
if (( ${#zcmds} )) print -R " cmd: ${(j:; :)zcmds[@]}" if (( ${#zcmds} )) print -R ' cmd: '${(j:; :)zcmds}
fi fi
} }

View file

@ -1,13 +1,12 @@
<% <%
class Zim class Zim
attr_reader :version, :home, :min_zsh_version, :startup_files_glob, :url_regex, attr_reader :version, :home, :min_zsh_version, :url_regex,
:clear_line, :ellipsis, :okay, :warn, :error, :done, :failed :clear_line, :ellipsis, :okay, :warn, :error, :done, :failed
def initialize def initialize
@version = "1.7.0-SNAPSHOT" @version = "1.7.0-SNAPSHOT"
@home = "${ZDOTDIR:-${HOME}}" @home = "${ZDOTDIR:-${HOME}}"
@min_zsh_version = "5.2" @min_zsh_version = "5.2"
@startup_files_glob = ".z(shenv|profile|shrc|login|logout)"
# 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
# but not file:///path/to/repo or /path/to/repo # but not file:///path/to/repo or /path/to/repo
# ${match[3]} contains host, and ${match[4]} contains org/repo # ${match[3]} contains host, and ${match[4]} contains org/repo

View file

@ -249,11 +249,11 @@ Initialization options:
local -ra prezto_scripts=(${zdir}/init.zsh(N)) local -ra prezto_scripts=(${zdir}/init.zsh(N))
if (( ${#zfpaths} && ${#prezto_scripts} )); then if (( ${#zfpaths} && ${#prezto_scripts} )); then
# this follows the prezto module format, no need to check for other scripts # this follows the prezto module format, no need to check for other scripts
zcmds=("source ${^prezto_scripts[@]:A}") zcmds=('source '${^prezto_scripts:A})
else else
# get script with largest size (descending `O`rder by `L`ength, and return only `[1]` first) # get script with largest size (descending `O`rder by `L`ength, and return only `[1]` first)
local -ra zscripts=(${zdir}/(init.zsh|${zmodule:t}.(zsh|plugin.zsh|zsh-theme|sh))(NOL[1])) local -ra zscripts=(${zdir}/(init.zsh|${zmodule:t}.(zsh|plugin.zsh|zsh-theme|sh))(NOL[1]))
zcmds=("source ${^zscripts[@]:A}") zcmds=('source '${^zscripts:A})
fi fi
fi fi
if (( ! ${#zfpaths} && ! ${#zfunctions} && ! ${#zcmds} )); then if (( ! ${#zfpaths} && ! ${#zfunctions} && ! ${#zcmds} )); then
@ -352,7 +352,7 @@ _zimfw_compile() {
} }
_zimfw_info() { _zimfw_info() {
print -R 'zimfw version: '${_zversion}' (built at 2022-01-10 16:15:12 UTC, previous commit is cfc955c)' print -R 'zimfw version: '${_zversion}' (built at 2022-01-11 16:25:04 UTC, previous commit is 2491856)'
print -R 'ZIM_HOME: '${ZIM_HOME} print -R 'ZIM_HOME: '${ZIM_HOME}
print -R 'Zsh version: '${ZSH_VERSION} print -R 'Zsh version: '${ZSH_VERSION}
print -R 'System info: '$(command uname -a) print -R 'System info: '$(command uname -a)
@ -420,9 +420,9 @@ _zimfw_run_list() {
# Match and remove the current module prefix from _zfpaths, _zfunctions and _zcmds # Match and remove the current module prefix from _zfpaths, _zfunctions and _zcmds
local -r zpre=${zmodule}$'\0' local -r zpre=${zmodule}$'\0'
local -r zfpaths=(${${(M)_zfpaths:#${zpre}*}#${zpre}}) zfunctions=(${${(M)_zfunctions:#${zpre}*}#${zpre}}) zcmds=(${${(M)_zcmds:#${zpre}*}#${zpre}}) local -r zfpaths=(${${(M)_zfpaths:#${zpre}*}#${zpre}}) zfunctions=(${${(M)_zfunctions:#${zpre}*}#${zpre}}) zcmds=(${${(M)_zcmds:#${zpre}*}#${zpre}})
if (( ${#zfpaths} )) print -R " fpath: ${zfpaths[@]}" if (( ${#zfpaths} )) print -R ' fpath: '${zfpaths}
if (( ${#zfunctions} )) print -R " autoload: ${zfunctions[@]}" if (( ${#zfunctions} )) print -R ' autoload: '${zfunctions}
if (( ${#zcmds} )) print -R " cmd: ${(j:; :)zcmds[@]}" if (( ${#zcmds} )) print -R ' cmd: '${(j:; :)zcmds}
fi fi
} }