Compare commits
10 commits
Author | SHA1 | Date | |
---|---|---|---|
897afc9cf9 | |||
76164d6217 | |||
9a47fde0c8 | |||
06f8bc71a3 | |||
9dc4056c4e | |||
96f60da366 | |||
cdd9258d5c | |||
4fcc85b2db | |||
4200e6cdb3 | |||
c86223f473 |
22
CHANGELOG.md
22
CHANGELOG.md
|
@ -7,13 +7,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
_No unreleased changes._
|
||||
### Changed
|
||||
|
||||
- Don't allow calling `zmodule` from the command line. Let it fail with "command
|
||||
not found" instead, as it's intended to be used only in the .zimrc script.
|
||||
- Allow zimfw.zsh to exist anywhere else, not only inside `ZIM_HOME`. This
|
||||
enables installing the zimfw.zsh script independently with a package manager.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Update error messages to hopefully make it clearer when either the git or the
|
||||
degit tool is being used.
|
||||
- Set read permissions to generated init.zsh script, so it can be read from
|
||||
other users.
|
||||
|
||||
## [1.13.1] - 2024-04-28
|
||||
|
||||
### Fixed
|
||||
|
||||
- The `--strip` option in tar command is not BSD compatible.
|
||||
|
||||
## [1.13.0] - 2024-02-17
|
||||
|
||||
### Added
|
||||
|
||||
- `--if-command` option to zmodule. This option is equivalent to
|
||||
- `--if-command` option to `zmodule`. This option is equivalent to
|
||||
`--if "(( \${+commands[${1}]} ))"`.
|
||||
- `mkdir` tool option in `zmodule` that creates an empty directory. This allows
|
||||
creating modules that contain only externally generated files.
|
||||
|
|
50
README.md
50
README.md
|
@ -47,12 +47,14 @@ Installing Zim is easy. You can choose either the automatic or manual method bel
|
|||
This will install a predefined set of modules and a theme for you.
|
||||
|
||||
* With `curl`:
|
||||
|
||||
```zsh
|
||||
curl -fsSL https://raw.githubusercontent.com/zimfw/install/master/install.zsh | zsh
|
||||
```
|
||||
|
||||
* With `wget`:
|
||||
|
||||
```zsh
|
||||
wget -nv -O - https://raw.githubusercontent.com/zimfw/install/master/install.zsh | zsh
|
||||
```
|
||||
|
||||
Restart your terminal and you're done. Enjoy your Zsh IMproved! Take some time
|
||||
to tweak your [`~/.zshrc`](#set-up-zshrc) file, and to also check the available
|
||||
|
@ -82,7 +84,16 @@ Add the lines below to your `~/.zshrc` file, in the following order:
|
|||
This is optional, and only required if you don't have `git` installed (yes,
|
||||
Zim works even without `git`!)
|
||||
|
||||
2. To set where the directory used by Zim will be located:
|
||||
2. To set where the `zimfw` plugin manager configuration file will be located:
|
||||
```zsh
|
||||
ZIM_CONFIG_FILE=~/.config/zsh/zimrc
|
||||
```
|
||||
This is optional. The value of `ZIM_CONFIG_FILE` can be any path your user
|
||||
has at least read access to. By default, the file must be at `~/.zimrc`, if
|
||||
the `ZDOTDIR` environment variable is not defined. Otherwise, it must be at
|
||||
`${ZDOTDIR}/.zimrc`.
|
||||
|
||||
3. To set where the directory used by Zim will be located:
|
||||
```zsh
|
||||
ZIM_HOME=~/.zim
|
||||
```
|
||||
|
@ -91,7 +102,7 @@ Add the lines below to your `~/.zshrc` file, in the following order:
|
|||
`~/.cache/zim` if you also include the step below, that automatically
|
||||
downloads the `zimfw` plugin manager.
|
||||
|
||||
3. To automatically download the `zimfw` plugin manager if missing:
|
||||
4. To automatically download the `zimfw` plugin manager if missing:
|
||||
```zsh
|
||||
# Download zimfw plugin manager if missing.
|
||||
if [[ ! -e ${ZIM_HOME}/zimfw.zsh ]]; then
|
||||
|
@ -110,11 +121,11 @@ Add the lines below to your `~/.zshrc` file, in the following order:
|
|||
This is optional. If you choose to not include this step, you should manually
|
||||
download the `zimfw.zsh` script once and keep it at `${ZIM_HOME}`.
|
||||
|
||||
4. To automatically install missing modules and update the static initialization
|
||||
5. To automatically install missing modules and update the static initialization
|
||||
script if missing or outdated:
|
||||
```zsh
|
||||
# Install missing modules, and update ${ZIM_HOME}/init.zsh if missing or outdated.
|
||||
if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZDOTDIR:-${HOME}}/.zimrc ]]; then
|
||||
if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZIM_CONFIG_FILE:-${ZDOTDIR:-${HOME}}/.zimrc} ]]; then
|
||||
source ${ZIM_HOME}/zimfw.zsh init -q
|
||||
fi
|
||||
```
|
||||
|
@ -122,7 +133,7 @@ Add the lines below to your `~/.zshrc` file, in the following order:
|
|||
it, you must remember to manually run `zimfw install` every time after you
|
||||
update your [`~/.zimrc`](#create-zimrc) file.
|
||||
|
||||
5. To source the static script, that will initialize your modules:
|
||||
6. To source the static script, that will initialize your modules:
|
||||
```zsh
|
||||
# Initialize modules.
|
||||
source ${ZIM_HOME}/init.zsh
|
||||
|
@ -130,18 +141,31 @@ Add the lines below to your `~/.zshrc` file, in the following order:
|
|||
|
||||
#### Create `~/.zimrc`
|
||||
|
||||
You must create your `.zimrc` file at `~/.zimrc`, if the `ZDOTDIR` environment
|
||||
variable is not defined. Otherwise, it must be at `${ZDOTDIR}/.zimrc`. It's
|
||||
referred to as `~/.zimrc` in the documentation for the sake of simplicity.
|
||||
This file configures the `zimfw` plugin manager. It's referred to as `~/.zimrc`
|
||||
in the documentation for the sake of simplicity, but the actual location of the
|
||||
file is defined following these rules:
|
||||
|
||||
You can start with just:
|
||||
1. You can define the full path and name of the file with a `ZIM_CONFIG_FILE`
|
||||
environment variable. For example:
|
||||
```zsh
|
||||
ZIM_CONFIG_FILE=~/.config/zsh/zimrc
|
||||
```
|
||||
|
||||
2. Or, if you defined a `ZDOTDIR` environment variable, then the file must be at
|
||||
`${ZDOTDIR}/.zimrc`
|
||||
|
||||
3. Otherwise, it must be at at `~/.zimrc`, which is it's default location.
|
||||
|
||||
As for the contents of the file, you can start with just:
|
||||
```zsh
|
||||
zmodule zsh-users/zsh-syntax-highlighting
|
||||
zmodule zsh-users/zsh-autosuggestions
|
||||
```
|
||||
|
||||
If you also want one of our prompt [themes]:
|
||||
```
|
||||
```zsh
|
||||
zmodule git-info
|
||||
zmodule duration-info
|
||||
zmodule asciiship
|
||||
zmodule zsh-users/zsh-syntax-highlighting
|
||||
zmodule zsh-users/zsh-autosuggestions
|
||||
|
@ -149,6 +173,8 @@ zmodule zsh-users/zsh-autosuggestions
|
|||
|
||||
If you want to use our [completion] module too, instead of using `compinit` directly:
|
||||
```zsh
|
||||
zmodule git-info
|
||||
zmodule duration-info
|
||||
zmodule asciiship
|
||||
zmodule zsh-users/zsh-completions --fpath src
|
||||
zmodule completion
|
||||
|
|
|
@ -189,11 +189,11 @@ Per-call initialization options:
|
|||
shift
|
||||
zarg=${1}
|
||||
if [[ ${zarg} != /* ]] zarg=${zroot_dir}/${zarg}
|
||||
zcmds+=("source ${(q-)zarg:a}")
|
||||
zcmds+=('source '${(qqq)zarg:a})
|
||||
;;
|
||||
-c|--cmd)
|
||||
shift
|
||||
zcmds+=(${1//{}/${(q-)zroot_dir:a}})
|
||||
zcmds+=(${1//{}/${(qqq)zroot_dir:a}})
|
||||
;;
|
||||
-d|--disabled) _zdisabled_root_dirs+=(${zroot_dir}) ;;
|
||||
*)
|
||||
|
@ -221,11 +221,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 '${(q-)^prezto_scripts:a})
|
||||
zcmds=('source '${(qqq)^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 '${(q-)^zscripts:a})
|
||||
zcmds=('source '${(qqq)^zscripts:a})
|
||||
fi
|
||||
fi
|
||||
if (( ! ${#zfpaths} && ! ${#zfunctions} && ! ${#zcmds} )); then
|
||||
|
@ -235,6 +235,7 @@ Per-call initialization options:
|
|||
local -r zpre=${zroot_dir}$'\0'
|
||||
_zfpaths+=(${zpre}${^zfpaths})
|
||||
_zfunctions+=(${zpre}${^zfunctions})
|
||||
zcmds=(${zcmds//${HOME}/\${HOME}})
|
||||
_zcmds+=(${zpre}${^zcmds})
|
||||
fi
|
||||
}
|
|
@ -4,5 +4,9 @@ autoload -Uz is-at-least && if ! is-at-least <%= min_zsh_version %>; then
|
|||
fi
|
||||
autoload -Uz zargs
|
||||
|
||||
if (( ! ${+ZIM_HOME} )); then
|
||||
print -u2 -R $'<%= red %>'${0}$': ZIM_HOME not defined<%= normal %>'
|
||||
return 1
|
||||
fi
|
||||
# Define zimfw location
|
||||
if (( ! ${+ZIM_HOME} )) typeset -g ZIM_HOME=${0:h}
|
||||
typeset -g __ZIMFW_PATH=${0:h}
|
||||
|
|
|
@ -7,6 +7,6 @@ _zimfw_mv() {
|
|||
if [[ -e ${2} ]]; then
|
||||
command mv -f ${2}{,.old} || return 1
|
||||
fi
|
||||
command mv -f ${1} ${2} && _zimfw_print -R $'<%= okay %><%= bold %>'${2}$':<%= normal %> Updated.'${_zrestartmsg}
|
||||
command mv -f ${1} ${2} && command chmod a+r ${2} && _zimfw_print -R $'<%= okay %><%= bold %>'${2}$':<%= normal %> Updated.'${_zrestartmsg}
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -5,8 +5,7 @@ _zimfw_build_init() {
|
|||
command mv -f ${ztarget}{,.old} || return 1
|
||||
fi
|
||||
_zimfw_mv =(
|
||||
print -R "zimfw() { source ${(q-)ZIM_HOME}/zimfw.zsh \"\${@}\" }"
|
||||
print -R "zmodule() { source ${(q-)ZIM_HOME}/zimfw.zsh \"\${@}\" }"
|
||||
print -R 'zimfw() { source '${${(qqq)__ZIMFW_PATH}/${HOME}/\${HOME}}'/zimfw.zsh "${@}" }'
|
||||
local zroot_dir zpre
|
||||
local -a zif_functions zif_cmds zroot_functions zroot_cmds
|
||||
local -a zfunctions=(${_zfunctions}) zcmds=(${_zcmds})
|
||||
|
@ -22,7 +21,7 @@ _zimfw_build_init() {
|
|||
fi
|
||||
done
|
||||
zpre=$'*\0'
|
||||
if (( ${#_zfpaths} )) print -R 'fpath=('${(q-)${_zfpaths#${~zpre}}:a}' ${fpath})'
|
||||
if (( ${#_zfpaths} )) print -R 'fpath=('${${(qqq)${_zfpaths#${~zpre}}:a}/${HOME}/\${HOME}}' ${fpath})'
|
||||
if (( ${#zfunctions} )) print -R 'autoload -Uz -- '${zfunctions#${~zpre}}
|
||||
for zroot_dir in ${_zroot_dirs}; do
|
||||
zpre=${zroot_dir}$'\0'
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
_zimfw_source_zimrc() {
|
||||
<%= render_all("src/functions/*.erb") %>
|
||||
{
|
||||
local -r ztarget=${ZIM_CONFIG_FILE:-<%= home %>/.zimrc} _zflags=${1}
|
||||
local -i _zfailed=0
|
||||
if ! source ${ztarget} || (( _zfailed )); then
|
||||
|
@ -17,4 +19,7 @@ _zimfw_source_zimrc() {
|
|||
_zfunctions=(${_zfunctions:#${zpre}*})
|
||||
_zcmds=(${_zcmds:#${zpre}*})
|
||||
done
|
||||
} always {
|
||||
unfunction zmodule
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
_zimfw_upgrade() {
|
||||
local -r ztarget=${ZIM_HOME}/zimfw.zsh zurl=https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh.gz
|
||||
local -r ztarget=${__ZIMFW_PATH}/zimfw.zsh zurl=https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh.gz
|
||||
{
|
||||
if (( ${+commands[curl]} )); then
|
||||
command curl -fsSL -o ${ztarget}.new.gz ${zurl} || return 1
|
||||
|
|
|
@ -4,7 +4,7 @@ _zimfw_download_tarball() {
|
|||
readonly REPO=${match[4]%.git}
|
||||
fi
|
||||
if [[ ${HOST} != github.com || -z ${REPO} ]]; then
|
||||
_zimfw_print_error "${URL} is not a valid GitHub URL. Will not try to ${_zaction}."
|
||||
_zimfw_print_error ${URL}$' is not a valid URL. Will not try to '${_zaction}$'. The zimfw degit tool only supports GitHub URLs. Use zmodule option <%= bold %>--use git<%= normalred %> to use git instead.'
|
||||
return 1
|
||||
fi
|
||||
readonly HEADERS_TARGET=${DIR}/${TEMP}_headers
|
||||
|
@ -12,7 +12,7 @@ _zimfw_download_tarball() {
|
|||
if [[ -r ${INFO_TARGET} ]]; then
|
||||
readonly INFO=("${(@f)"$(<${INFO_TARGET})"}")
|
||||
if [[ ${URL} != ${INFO[1]} ]]; then
|
||||
_zimfw_print_error "URL does not match. Expected ${URL}. Will not try to ${_zaction}."
|
||||
_zimfw_print_error "The zimfw degit URL does not match. Expected ${URL}. Will not try to ${_zaction}."
|
||||
return 1
|
||||
fi
|
||||
# Previous REV is in line 2, reserved for future use.
|
||||
|
@ -71,10 +71,17 @@ _zimfw_download_tarball() {
|
|||
}
|
||||
|
||||
_zimfw_untar_tarball() {
|
||||
if ! ERR=$(command tar -C ${1} --strip=1 -xzf ${TARBALL_TARGET} 2>&1); then
|
||||
if ! ERR=$(command tar -C ${1} -xzf ${TARBALL_TARGET} 2>&1); then
|
||||
_zimfw_print_error "Error extracting ${TARBALL_TARGET}" ${ERR}
|
||||
return 1
|
||||
fi
|
||||
local zsubdir
|
||||
for zsubdir in ${1}/*(/); do
|
||||
if ! ERR=$(command mv -f ${zsubdir}/*(DN) ${1} 2>&1 && command rmdir ${zsubdir} 2>&1); then
|
||||
_zimfw_print_error "Error moving ${zsubdir}" ${ERR}
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
_zimfw_tool_degit() {
|
||||
|
|
|
@ -18,7 +18,7 @@ _zimfw_tool_git() {
|
|||
return 0
|
||||
fi
|
||||
if [[ ${URL} != $(command git -C ${DIR} config --get remote.origin.url) ]]; then
|
||||
_zimfw_print_error "URL does not match. Expected ${URL}. Will not try to ${_zaction}."
|
||||
_zimfw_print_error "The git URL does not match. Expected ${URL}. Will not try to ${_zaction}."
|
||||
return 1
|
||||
fi
|
||||
if ! ERR=$(command git -C ${DIR} fetch -pqt origin 2>&1); then
|
||||
|
|
|
@ -4,7 +4,7 @@ class Zim
|
|||
:bold, :normal, :red, :normalred, :yellow, :normalyellow, :clear_line, :ellipsis, :okay, :warn, :error
|
||||
|
||||
def initialize
|
||||
@version = "1.13.0"
|
||||
@version = "1.14.0-SNAPSHOT"
|
||||
@home = "${ZDOTDIR:-${HOME}}"
|
||||
@min_zsh_version = "5.2"
|
||||
# Matches {ssh,http,https,git}://{user@,}host/org/repo and {user@,}host:org/repo
|
||||
|
@ -42,8 +42,4 @@ zim = Zim.new
|
|||
|
||||
<%= zim.render_commented("LICENSE") %>
|
||||
<%= zim.render_all("src/stage2/*.erb") %>
|
||||
if [[ ${functrace[1]} == zmodule:* ]]; then
|
||||
zmodule "${@}"
|
||||
else
|
||||
zimfw "${@}"
|
||||
fi
|
||||
zimfw "${@}"
|
||||
|
|
55
zimfw.zsh
55
zimfw.zsh
|
@ -30,8 +30,12 @@ autoload -Uz is-at-least && if ! is-at-least 5.2; then
|
|||
fi
|
||||
autoload -Uz zargs
|
||||
|
||||
if (( ! ${+ZIM_HOME} )); then
|
||||
print -u2 -R $'\E[31m'${0}$': ZIM_HOME not defined\E[0m'
|
||||
return 1
|
||||
fi
|
||||
# Define zimfw location
|
||||
if (( ! ${+ZIM_HOME} )) typeset -g ZIM_HOME=${0:h}
|
||||
typeset -g __ZIMFW_PATH=${0:h}
|
||||
|
||||
_zimfw_print() {
|
||||
if (( _zprintlevel > 0 )) print "${@}"
|
||||
|
@ -46,7 +50,7 @@ _zimfw_mv() {
|
|||
if [[ -e ${2} ]]; then
|
||||
command mv -f ${2}{,.old} || return 1
|
||||
fi
|
||||
command mv -f ${1} ${2} && _zimfw_print -R $'\E[32m)\E[0m \E[1m'${2}$':\E[0m Updated.'${_zrestartmsg}
|
||||
command mv -f ${1} ${2} && command chmod a+r ${2} && _zimfw_print -R $'\E[32m)\E[0m \E[1m'${2}$':\E[0m Updated.'${_zrestartmsg}
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -57,8 +61,7 @@ _zimfw_build_init() {
|
|||
command mv -f ${ztarget}{,.old} || return 1
|
||||
fi
|
||||
_zimfw_mv =(
|
||||
print -R "zimfw() { source ${(q-)ZIM_HOME}/zimfw.zsh \"\${@}\" }"
|
||||
print -R "zmodule() { source ${(q-)ZIM_HOME}/zimfw.zsh \"\${@}\" }"
|
||||
print -R 'zimfw() { source '${${(qqq)__ZIMFW_PATH}/${HOME}/\${HOME}}'/zimfw.zsh "${@}" }'
|
||||
local zroot_dir zpre
|
||||
local -a zif_functions zif_cmds zroot_functions zroot_cmds
|
||||
local -a zfunctions=(${_zfunctions}) zcmds=(${_zcmds})
|
||||
|
@ -74,7 +77,7 @@ _zimfw_build_init() {
|
|||
fi
|
||||
done
|
||||
zpre=$'*\0'
|
||||
if (( ${#_zfpaths} )) print -R 'fpath=('${(q-)${_zfpaths#${~zpre}}:a}' ${fpath})'
|
||||
if (( ${#_zfpaths} )) print -R 'fpath=('${${(qqq)${_zfpaths#${~zpre}}:a}/${HOME}/\${HOME}}' ${fpath})'
|
||||
if (( ${#zfunctions} )) print -R 'autoload -Uz -- '${zfunctions#${~zpre}}
|
||||
for zroot_dir in ${_zroot_dirs}; do
|
||||
zpre=${zroot_dir}$'\0'
|
||||
|
@ -110,6 +113,7 @@ _zimfw_build() {
|
|||
_zimfw_build_init && _zimfw_build_login_init && _zimfw_print 'Done with build.'
|
||||
}
|
||||
|
||||
_zimfw_source_zimrc() {
|
||||
zmodule() {
|
||||
local -r ztarget=${ZIM_CONFIG_FILE:-${ZDOTDIR:-${HOME}}/.zimrc}
|
||||
local -r zusage=$'Usage: \E[1m'${0}$'\E[0m <url> [\E[1m-n\E[0m|\E[1m--name\E[0m <module_name>] [\E[1m-r\E[0m|\E[1m--root\E[0m <path>] [options]
|
||||
|
@ -301,11 +305,11 @@ Per-call initialization options:
|
|||
shift
|
||||
zarg=${1}
|
||||
if [[ ${zarg} != /* ]] zarg=${zroot_dir}/${zarg}
|
||||
zcmds+=("source ${(q-)zarg:a}")
|
||||
zcmds+=('source '${(qqq)zarg:a})
|
||||
;;
|
||||
-c|--cmd)
|
||||
shift
|
||||
zcmds+=(${1//{}/${(q-)zroot_dir:a}})
|
||||
zcmds+=(${1//{}/${(qqq)zroot_dir:a}})
|
||||
;;
|
||||
-d|--disabled) _zdisabled_root_dirs+=(${zroot_dir}) ;;
|
||||
*)
|
||||
|
@ -333,11 +337,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 '${(q-)^prezto_scripts:a})
|
||||
zcmds=('source '${(qqq)^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 '${(q-)^zscripts:a})
|
||||
zcmds=('source '${(qqq)^zscripts:a})
|
||||
fi
|
||||
fi
|
||||
if (( ! ${#zfpaths} && ! ${#zfunctions} && ! ${#zcmds} )); then
|
||||
|
@ -347,11 +351,12 @@ Per-call initialization options:
|
|||
local -r zpre=${zroot_dir}$'\0'
|
||||
_zfpaths+=(${zpre}${^zfpaths})
|
||||
_zfunctions+=(${zpre}${^zfunctions})
|
||||
zcmds=(${zcmds//${HOME}/\${HOME}})
|
||||
_zcmds+=(${zpre}${^zcmds})
|
||||
fi
|
||||
}
|
||||
|
||||
_zimfw_source_zimrc() {
|
||||
{
|
||||
local -r ztarget=${ZIM_CONFIG_FILE:-${ZDOTDIR:-${HOME}}/.zimrc} _zflags=${1}
|
||||
local -i _zfailed=0
|
||||
if ! source ${ztarget} || (( _zfailed )); then
|
||||
|
@ -370,6 +375,9 @@ _zimfw_source_zimrc() {
|
|||
_zfunctions=(${_zfunctions:#${zpre}*})
|
||||
_zcmds=(${_zcmds:#${zpre}*})
|
||||
done
|
||||
} always {
|
||||
unfunction zmodule
|
||||
}
|
||||
}
|
||||
|
||||
_zimfw_list_unuseds() {
|
||||
|
@ -454,7 +462,7 @@ _zimfw_compile() {
|
|||
}
|
||||
|
||||
_zimfw_info() {
|
||||
print -R 'zimfw version: '${_zversion}' (built at 2024-02-17 02:05:06 UTC, previous commit is 9de3984)'
|
||||
print -R 'zimfw version: '${_zversion}' (built at 2024-06-17 12:21:22 UTC, previous commit is 76164d6)'
|
||||
local zparam
|
||||
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}
|
||||
|
@ -474,7 +482,7 @@ _zimfw_uninstall() {
|
|||
}
|
||||
|
||||
_zimfw_upgrade() {
|
||||
local -r ztarget=${ZIM_HOME}/zimfw.zsh zurl=https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh.gz
|
||||
local -r ztarget=${__ZIMFW_PATH}/zimfw.zsh zurl=https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh.gz
|
||||
{
|
||||
if (( ${+commands[curl]} )); then
|
||||
command curl -fsSL -o ${ztarget}.new.gz ${zurl} || return 1
|
||||
|
@ -578,7 +586,7 @@ _zimfw_download_tarball() {
|
|||
readonly REPO=${match[4]%.git}
|
||||
fi
|
||||
if [[ ${HOST} != github.com || -z ${REPO} ]]; then
|
||||
_zimfw_print_error "${URL} is not a valid GitHub URL. Will not try to ${_zaction}."
|
||||
_zimfw_print_error ${URL}$' is not a valid URL. Will not try to '${_zaction}$'. The zimfw degit tool only supports GitHub URLs. Use zmodule option \E[1m--use git\E[0;31m to use git instead.'
|
||||
return 1
|
||||
fi
|
||||
readonly HEADERS_TARGET=${DIR}/${TEMP}_headers
|
||||
|
@ -586,7 +594,7 @@ _zimfw_download_tarball() {
|
|||
if [[ -r ${INFO_TARGET} ]]; then
|
||||
readonly INFO=("${(@f)"$(<${INFO_TARGET})"}")
|
||||
if [[ ${URL} != ${INFO[1]} ]]; then
|
||||
_zimfw_print_error "URL does not match. Expected ${URL}. Will not try to ${_zaction}."
|
||||
_zimfw_print_error "The zimfw degit URL does not match. Expected ${URL}. Will not try to ${_zaction}."
|
||||
return 1
|
||||
fi
|
||||
# Previous REV is in line 2, reserved for future use.
|
||||
|
@ -645,10 +653,17 @@ _zimfw_download_tarball() {
|
|||
}
|
||||
|
||||
_zimfw_untar_tarball() {
|
||||
if ! ERR=$(command tar -C ${1} --strip=1 -xzf ${TARBALL_TARGET} 2>&1); then
|
||||
if ! ERR=$(command tar -C ${1} -xzf ${TARBALL_TARGET} 2>&1); then
|
||||
_zimfw_print_error "Error extracting ${TARBALL_TARGET}" ${ERR}
|
||||
return 1
|
||||
fi
|
||||
local zsubdir
|
||||
for zsubdir in ${1}/*(/); do
|
||||
if ! ERR=$(command mv -f ${zsubdir}/*(DN) ${1} 2>&1 && command rmdir ${zsubdir} 2>&1); then
|
||||
_zimfw_print_error "Error moving ${zsubdir}" ${ERR}
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
_zimfw_tool_degit() {
|
||||
|
@ -731,7 +746,7 @@ _zimfw_tool_git() {
|
|||
return 0
|
||||
fi
|
||||
if [[ ${URL} != $(command git -C ${DIR} config --get remote.origin.url) ]]; then
|
||||
_zimfw_print_error "URL does not match. Expected ${URL}. Will not try to ${_zaction}."
|
||||
_zimfw_print_error "The git URL does not match. Expected ${URL}. Will not try to ${_zaction}."
|
||||
return 1
|
||||
fi
|
||||
if ! ERR=$(command git -C ${DIR} fetch -pqt origin 2>&1); then
|
||||
|
@ -874,7 +889,7 @@ _zimfw_run_tool_action() {
|
|||
|
||||
zimfw() {
|
||||
builtin emulate -L zsh -o EXTENDED_GLOB
|
||||
local -r _zversion='1.13.0' _zversion_target=${ZIM_HOME}/.latest_version zusage=$'Usage: \E[1m'${0}$'\E[0m <action> [\E[1m-q\E[0m|\E[1m-v\E[0m]
|
||||
local -r _zversion='1.14.0-SNAPSHOT' _zversion_target=${ZIM_HOME}/.latest_version zusage=$'Usage: \E[1m'${0}$'\E[0m <action> [\E[1m-q\E[0m|\E[1m-v\E[0m]
|
||||
|
||||
Actions:
|
||||
\E[1mbuild\E[0m Build \E[1m'${ZIM_HOME}$'/init.zsh\E[0m and \E[1m'${ZIM_HOME}$'/login_init.zsh\E[0m.
|
||||
|
@ -978,8 +993,4 @@ Options:
|
|||
esac
|
||||
}
|
||||
|
||||
if [[ ${functrace[1]} == zmodule:* ]]; then
|
||||
zmodule "${@}"
|
||||
else
|
||||
zimfw "${@}"
|
||||
fi
|
||||
zimfw "${@}"
|
||||
|
|
Loading…
Reference in a new issue