This commit is contained in:
Eric Nielsen 2022-09-27 17:45:16 -05:00
parent 05b8e0cdf2
commit 238da94b54
No known key found for this signature in database
GPG Key ID: 678AF5E338C87D99
5 changed files with 77 additions and 31 deletions

View File

@ -9,6 +9,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
_No unreleased changes._ _No unreleased changes._
## [1.10.0] - 2022-0x-xx
### Added
- `--root` option to `zmodule`. Combined with the ability to call `zmodule`
multiple times for the same module, this allows initializing from multiple
roots in repositories like prezto or ohmyzsh. Also, `--on-pull` and `--disable`
now work on a per-module-root basis.
### Changed
- Show `OSTYPE`, `TERM`, `TERM_PROGRAM` and `TERM_PROGRAM_VERSION` environment
variables instead of calling the `uname -a` command to show system info in the
`zimfw info` action.
## [1.9.1] - 2022-05-24 ## [1.9.1] - 2022-05-24
### Fixed ### Fixed
@ -289,7 +304,8 @@ Take your time to review the updated [README.md] and the changes listed below.
[termtitle]: https://github.com/zimfw/termtitle [termtitle]: https://github.com/zimfw/termtitle
[s1ck94]: https://github.com/zimfw/s1ck94 [s1ck94]: https://github.com/zimfw/s1ck94
[Unreleased]: https://github.com/zimfw/zimfw/compare/v1.9.1...HEAD [Unreleased]: https://github.com/zimfw/zimfw/compare/v1.10.0...HEAD
[1.10.0]: https://github.com/zimfw/zimfw/compare/v1.9.1...v1.10.0
[1.9.1]: https://github.com/zimfw/zimfw/compare/v1.9.0...v1.9.1 [1.9.1]: https://github.com/zimfw/zimfw/compare/v1.9.0...v1.9.1
[1.9.0]: https://github.com/zimfw/zimfw/compare/v1.8.0...v1.9.0 [1.9.0]: https://github.com/zimfw/zimfw/compare/v1.8.0...v1.9.0
[1.8.0]: https://github.com/zimfw/zimfw/compare/v1.7.0...v1.8.0 [1.8.0]: https://github.com/zimfw/zimfw/compare/v1.7.0...v1.8.0

View File

@ -170,8 +170,8 @@ The `zimfw` plugin manager installs your modules at `${ZIM_HOME}/modules`, and
builds a static script at `${ZIM_HOME}/init.zsh` that will initialize them. Your builds a static script at `${ZIM_HOME}/init.zsh` that will initialize them. Your
modules are defined in your `~/.zimrc` file. modules are defined in your `~/.zimrc` file.
The `~/.zimrc` file must contain a `zmodule` call for each module you want to The `~/.zimrc` file must contain `zmodule` calls to define the modules to be
use. The modules will be initialized in the order they are defined. initialized. The initialization will be done in the same order it's defined.
The `~/.zimrc` file is not sourced during Zsh startup, and it's only used to The `~/.zimrc` file is not sourced during Zsh startup, and it's only used to
configure the `zimfw` plugin manager. configure the `zimfw` plugin manager.
@ -192,28 +192,48 @@ Below are some usage examples:
`zmodule spaceship-prompt/spaceship-prompt --source spaceship.zsh --no-submodules` or `zmodule spaceship-prompt/spaceship-prompt --source spaceship.zsh --no-submodules` or
`zmodule spaceship-prompt/spaceship-prompt --name spaceship --no-submodules` `zmodule spaceship-prompt/spaceship-prompt --name spaceship --no-submodules`
* A module with two custom initialization files: * A module with two custom initialization files:
`zmodule sindresorhus/pure --source async.zsh --source pure.zsh` `zmodule sindresorhus/pure --source async.zsh --source pure.zsh`. Separate
zmodule calls can also be used. In this equivalent example, the second call
automatically discovers the second file to be sourced:
```
zmodule sindresorhus/pure --source async.zsh
zmodule sindresorhus/pure
```
* A module with a custom initialization command: * A module with a custom initialization command:
`zmodule skywind3000/z.lua --cmd 'eval "$(lua {}/z.lua --init zsh enhanced once)"'` `zmodule skywind3000/z.lua --cmd 'eval "$(lua {}/z.lua --init zsh enhanced once)"'`
* A module with an on-pull command. It can be used to create a cached initialization script: * A module with an on-pull command. It can be used to create a cached initialization script:
`zmodule skywind3000/z.lua --on-pull 'lua z.lua --init zsh enhanced once >! init.zsh'` `zmodule skywind3000/z.lua --on-pull 'lua z.lua --init zsh enhanced once >! init.zsh'`
* A module with a big git repository: `zmodule romkatv/powerlevel10k --use degit` * A module with a big git repository: `zmodule romkatv/powerlevel10k --use degit`
* A module with a custom root subdirectory: `zmodule ohmyzsh/ohmyzsh --root plugins/vim-interaction`
* A module with multiple roots:
```
zmodule sorin-ionescu/prezto --root modules/command-not-found
zmodule sorin-ionescu/prezto --root modules/gnu-utility
```
or
```
zmodule ohmyzsh/ohmyzsh --root plugins/perl
zmodule ohmyzsh/ohmyzsh --root plugins/vim-interaction
```
<details id="zmodule-usage"> <details id="zmodule-usage">
<summary>Want help with the complete <code>zmodule</code> usage?</summary> <summary>Want help with the complete <code>zmodule</code> usage?</summary>
<pre>Usage: <b>zmodule</b> &lt;url&gt; [<b>-n</b>|<b>--name</b> &lt;module_name&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 modules Add <b>zmodule</b> calls to your <b>~/.zimrc</b> file to define the modules to be initialized. The initiali-
are initialized in the same order they are defined. zation will be done in the same order it'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>.
<b>-n</b>|<b>--name</b> &lt;module_name&gt; Set a custom module name. Default: the last component in &lt;url&gt;. If an absolute path is given, the module is considered externally
Use slashes inside the name to organize the module into subdirec- installed, and won&apos;t be installed or updated by zimfw.
tories. <b>-n</b>|<b>--name</b> &lt;module_name&gt; Set a custom module name. Use slashes inside the name to organize
the module into subdirectories. The module will be installed at
<b>${ZIM_HOME}/</b>&lt;module_name&gt;. Default: the last component in &lt;url&gt;.
<b>-r</b>|<b>--root</b> &lt;path&gt; Relative path to the module root.
Repository options: Per-module options:
<b>-b</b>|<b>--branch</b> &lt;branch_name&gt; Use specified branch when installing and updating the module. <b>-b</b>|<b>--branch</b> &lt;branch_name&gt; Use specified branch when installing and updating the module.
Overrides the tag option. Default: the repository default branch. Overrides the tag option. Default: the repository default branch.
<b>-t</b>|<b>--tag</b> &lt;tag_name&gt; Use specified tag when installing and updating the module. Over- <b>-t</b>|<b>--tag</b> &lt;tag_name&gt; Use specified tag when installing and updating the module. Over-
@ -227,26 +247,36 @@ Repository options:
changes are lost on updates. Git submodules are not supported. changes are lost on updates. Git submodules are not supported.
<b>--no-submodules</b> Don&apos;t install or update git submodules. <b>--no-submodules</b> Don&apos;t install or update git submodules.
<b>-z</b>|<b>--frozen</b> Don&apos;t install or update the module. <b>-z</b>|<b>--frozen</b> Don&apos;t install or update the module.
The per-module options above are carried over multiple zmodule calls for the same module.
Modules are uniquely identified by their name.
Per-module-root options:
<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.
Initialization options: The per-module-root options above are carried over multiple zmodule calls for the same mod-
<b>-f</b>|<b>--fpath</b> &lt;path&gt; Add specified path to fpath. The path is relative to the module ule root.
root directory. Default: <b>functions</b>, if the subdirectory exists.
<b>-a</b>|<b>--autoload</b> &lt;func_name&gt; Autoload specified function. Default: all valid names inside the Per-call initialization options:
<b>functions</b> subdirectory, if any. <b>-f</b>|<b>--fpath</b> &lt;path&gt; Will add specified path to fpath. The path is relative to the
<b>-s</b>|<b>--source</b> &lt;file_path&gt; Source specified file. The file path is relative to the module module root directory. Default: <b>functions</b>, if the subdirectory
root directory. Default: <b>init.zsh</b>, if the <b>functions</b> subdirectory exists and is non-empty.
also exists, or the largest of the files with name matching <b>-a</b>|<b>--autoload</b> &lt;func_name&gt; Will autoload specified function. Default: all valid names inside
<b>{init.zsh,module_name.{zsh,plugin.zsh,zsh-theme,sh}}</b>, if any. the <b>functions</b> subdirectory, if any.
<b>-c</b>|<b>--cmd</b> &lt;command&gt; Execute specified command. Occurrences of the <b>{}</b> placeholder in <b>-s</b>|<b>--source</b> &lt;file_path&gt; Will source specified file. The path is relative to the module
the command are substituted by the module root directory path. 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
<b>(init.zsh|</b>&lt;root_tail&gt;<b>.(zsh|plugin.zsh|zsh-theme|sh))</b>, if any.
<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.
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.
<b>-d</b>|<b>--disabled</b> Don&apos;t initialize or uninstall the module.
Setting any initialization option above will disable all the default values from the other Setting any per-call initialization option above will disable the default values from the
initialization options, so only your provided values are used. I.e. these values are either other per-call initialization options, so only your provided values will be used. I.e. these
all automatic, or all manual. values are either all automatic, or all manual in each zmodule call. To use default values
and also provided values, use separate zmodule calls.
</pre> </pre>
</details> </details>

View File

@ -12,7 +12,7 @@ The initialization will be done in the same order it's defined.
the module into subdirectories. The module will be installed at the module into subdirectories. The module will be installed at
%B${ZIM_HOME}/%b<module_name>. %B${ZIM_HOME}/%b<module_name>.
Default: the last component in <url>. Default: the last component in <url>.
%B-r%b|%B--root%b <path> Relative path to the module root. Default: none. %B-r%b|%B--root%b <path> Relative path to the module root.
Per-module options: Per-module options:
%B-b%b|%B--branch%b <branch_name> Use specified branch when installing and updating the module. %B-b%b|%B--branch%b <branch_name> Use specified branch when installing and updating 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.10.0-SNAPSHOT" @version = "1.10.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

@ -98,7 +98,7 @@ The initialization will be done in the same order it's defined.
the module into subdirectories. The module will be installed at the module into subdirectories. The module will be installed at
%B${ZIM_HOME}/%b<module_name>. %B${ZIM_HOME}/%b<module_name>.
Default: the last component in <url>. Default: the last component in <url>.
%B-r%b|%B--root%b <path> Relative path to the module root. Default: none. %B-r%b|%B--root%b <path> Relative path to the module root.
Per-module options: Per-module options:
%B-b%b|%B--branch%b <branch_name> Use specified branch when installing and updating the module. %B-b%b|%B--branch%b <branch_name> Use specified branch when installing and updating the module.
@ -420,7 +420,7 @@ _zimfw_compile() {
} }
_zimfw_info() { _zimfw_info() {
print -R 'zimfw version: '${_zversion}' (built at 2022-09-27 01:07:23 UTC, previous commit is 887bfd6)' print -R 'zimfw version: '${_zversion}' (built at 2022-09-27 22:44:10 UTC, previous commit is 05b8e0c)'
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}
@ -807,7 +807,7 @@ esac
zimfw() { zimfw() {
builtin emulate -L zsh -o EXTENDED_GLOB builtin emulate -L zsh -o EXTENDED_GLOB
local -r _zversion='1.10.0-SNAPSHOT' zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b] local -r _zversion='1.10.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.