This commit is contained in:
Eric Nielsen 2022-12-18 15:58:30 -05:00
parent e54958b91c
commit 281cde57f7
No known key found for this signature in database
GPG Key ID: 678AF5E338C87D99
5 changed files with 39 additions and 8 deletions

View File

@ -9,6 +9,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
_No unreleased changes._ _No unreleased changes._
## [1.11.0] - 2022-12-18
### Added
- `--if` option to `zmodule` that will only initialize the module root if the
specified test returns a zero exit status. The test is evaluated at every new
terminal startup.
- Ability to customize the .zimrc file name and path with the `ZIM_CONFIG_FILE`
environment variable.
## [1.10.0] - 2022-09-27 ## [1.10.0] - 2022-09-27
### Added ### Added

View File

@ -222,15 +222,16 @@ Below are some usage examples:
<pre>Usage: <b>zmodule</b> &lt;url&gt; [<b>-n</b>|<b>--name</b> &lt;module_name&gt;] [<b>-r</b>|<b>--root</b> &lt;path&gt;] [options] <pre>Usage: <b>zmodule</b> &lt;url&gt; [<b>-n</b>|<b>--name</b> &lt;module_name&gt;] [<b>-r</b>|<b>--root</b> &lt;path&gt;] [options]
Add <b>zmodule</b> calls to your <b>~/.zimrc</b> file to define the modules to be initialized. The initiali- Add <b>zmodule</b> calls to your <b>~/.zimrc</b> file to define the modules to be initialized. The initiali-
zation will be done in the same order it's defined. zation will be done in the same order it&apos;s defined.
&lt;url&gt; Module absolute path or repository URL. The following URL formats &lt;url&gt; Module absolute path or repository URL. The following URL formats
are equivalent: <b>foo</b>, <b>zimfw/foo</b>, <b>https://github.com/zimfw/foo.git</b>. are equivalent: <b>foo</b>, <b>zimfw/foo</b>, <b>https://github.com/zimfw/foo.git</b>.
If an absolute path is given, the module is considered externally If an absolute path is given, the module is considered externally
installed, and won&apos;t be installed or updated by zimfw. installed, and won&apos;t be installed or updated by zimfw.
<b>-n</b>|<b>--name</b> &lt;module_name&gt; Set a custom module name. Use slashes inside the name to organize <b>-n</b>|<b>--name</b> &lt;module_name&gt; Set a custom module name. Default: the last component in &lt;url&gt;.
the module into subdirectories. The module will be installed at Slashes can be used inside the name to organize the module into
<b>${ZIM_HOME}/</b>&lt;module_name&gt;. Default: the last component in &lt;url&gt;. subdirectories. The module will be installed at
<b>${ZIM_HOME}/</b>&lt;module_name&gt;.
<b>-r</b>|<b>--root</b> &lt;path&gt; Relative path to the module root. <b>-r</b>|<b>--root</b> &lt;path&gt; Relative path to the module root.
Per-module options: Per-module options:
@ -252,6 +253,8 @@ Per-module options:
Modules are uniquely identified by their name. Modules are uniquely identified by their name.
Per-module-root options: Per-module-root options:
<b>--if</b> &lt;test&gt; Will only initialize module root if specified test returns a zero
exit status. The test is evaluated at every new terminal startup.
<b>--on-pull</b> &lt;command&gt; Execute command after installing or updating the module. The com- <b>--on-pull</b> &lt;command&gt; Execute command after installing or updating the module. The com-
mand is executed in the module root directory. mand is executed in the module root directory.
<b>-d</b>|<b>--disabled</b> Don&apos;t initialize the module root or uninstall the module. <b>-d</b>|<b>--disabled</b> Don&apos;t initialize the module root or uninstall the module.
@ -268,7 +271,9 @@ Per-call initialization options:
<b>-s</b>|<b>--source</b> &lt;file_path&gt; Will source specified file. The path is relative to the module <b>-s</b>|<b>--source</b> &lt;file_path&gt; Will source specified file. The path is relative to the module
root directory. Default: <b>init.zsh</b>, if a non-empty <b>functions</b> sub- root directory. Default: <b>init.zsh</b>, if a non-empty <b>functions</b> sub-
directory exists, else the largest of the files matching the glob directory exists, else the largest of the files matching the glob
<b>(init.zsh|</b>&lt;root_tail&gt;<b>.(zsh|plugin.zsh|zsh-theme|sh))</b>, if any. <b>(init.zsh|</b>&lt;name&gt;<b>.(zsh|plugin.zsh|zsh-theme|sh))</b>, if any.
&lt;name&gt; in the glob is resolved to the last component of the mod-
ule name, or the last component of the path to the module root.
<b>-c</b>|<b>--cmd</b> &lt;command&gt; Will execute specified command. Occurrences of the <b>{}</b> placeholder <b>-c</b>|<b>--cmd</b> &lt;command&gt; Will execute specified command. Occurrences of the <b>{}</b> placeholder
in the command are substituted by the module root directory path. in the command are substituted by the module root directory path.
I.e., <b>-s &apos;foo.zsh&apos;</b> and <b>-c &apos;source {}/foo.zsh&apos;</b> are equivalent. I.e., <b>-s &apos;foo.zsh&apos;</b> and <b>-c &apos;source {}/foo.zsh&apos;</b> are equivalent.
@ -293,6 +298,18 @@ The Zim plugin manager:
Settings Settings
-------- --------
Customize path of the directory used by Zim with the `ZIM_HOME` environment
variable:
ZIM_HOME=~/.zim
By default, the `zimfw` plugin manager configuration file must be at `~/.zimrc`,
if the `ZDOTDIR` environment variable is not defined. Otherwise, it must be at
`${ZDOTDIR}/.zimrc`. You can customize its full path and name with the
`ZIM_CONFIG_FILE` environment variable:
ZIM_CONFIG_FILE=~/.config/zsh/zimrc
Modules are installed using `git` by default. If you don't have `git` Modules are installed using `git` by default. If you don't have `git`
installed, or if you want to take advantage of our degit tool for faster and installed, or if you want to take advantage of our degit tool for faster and
lighter module installations, you can set degit as the default tool with: lighter module installations, you can set degit as the default tool with:

View File

@ -34,6 +34,8 @@ Per-module options:
Modules are uniquely identified by their name. Modules are uniquely identified by their name.
Per-module-root options: Per-module-root options:
%B--if%b <test> Will only initialize module root if specified test returns a zero
exit status. The test is evaluated at every new terminal startup.
%B--on-pull%b <command> Execute command after installing or updating the module. The com- %B--on-pull%b <command> Execute command after installing or updating the module. The com-
mand is executed in the module root directory. mand is executed in the module root directory.
%B-d%b|%B--disabled%b Don't initialize the module root or uninstall the module. %B-d%b|%B--disabled%b Don't initialize the module root or uninstall the module.

View File

@ -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.0-SNAPSHOT" @version = "1.11.0"
@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

View File

@ -148,6 +148,8 @@ Per-module options:
Modules are uniquely identified by their name. Modules are uniquely identified by their name.
Per-module-root options: Per-module-root options:
%B--if%b <test> Will only initialize module root if specified test returns a zero
exit status. The test is evaluated at every new terminal startup.
%B--on-pull%b <command> Execute command after installing or updating the module. The com- %B--on-pull%b <command> Execute command after installing or updating the module. The com-
mand is executed in the module root directory. mand is executed in the module root directory.
%B-d%b|%B--disabled%b Don't initialize the module root or uninstall the module. %B-d%b|%B--disabled%b Don't initialize the module root or uninstall the module.
@ -455,7 +457,7 @@ _zimfw_compile() {
} }
_zimfw_info() { _zimfw_info() {
print -R 'zimfw version: '${_zversion}' (built at 2022-10-24 00:21:20 UTC, previous commit is 3959a7f)' print -R 'zimfw version: '${_zversion}' (built at 2022-12-18 21:05:25 UTC, previous commit is e54958b)'
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}
@ -842,7 +844,7 @@ esac
zimfw() { zimfw() {
builtin emulate -L zsh -o EXTENDED_GLOB builtin emulate -L zsh -o EXTENDED_GLOB
local -r _zversion='1.11.0-SNAPSHOT' zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b] local -r _zversion='1.11.0' 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.