From 238da94b54638086ddd94ae87434c627eaabce92 Mon Sep 17 00:00:00 2001 From: Eric Nielsen <4120606+ericbn@users.noreply.github.com> Date: Tue, 27 Sep 2022 17:45:16 -0500 Subject: [PATCH] v1.10.0 --- CHANGELOG.md | 18 +++++++- README.md | 80 ++++++++++++++++++++++++----------- src/stage2/30_zmodule.zsh.erb | 2 +- src/zimfw.zsh.erb | 2 +- zimfw.zsh | 6 +-- 5 files changed, 77 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce49956..4e18e0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 _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 ### 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 [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.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 diff --git a/README.md b/README.md index e3de367..61f2973 100644 --- a/README.md +++ b/README.md @@ -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 modules are defined in your `~/.zimrc` file. -The `~/.zimrc` file must contain a `zmodule` call for each module you want to -use. The modules will be initialized in the order they are defined. +The `~/.zimrc` file must contain `zmodule` calls to define the modules to be +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 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 --name spaceship --no-submodules` * 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: `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: `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 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 + ```
Want help with the complete zmodule usage? -
Usage: zmodule <url> [-n|--name <module_name>] [options]
+
Usage: zmodule <url> [-n|--name <module_name>] [-r|--root <path>] [options]
 
-Add zmodule calls to your ~/.zimrc file to define the modules to be initialized. The modules
-are initialized in the same order they are defined.
+Add zmodule calls to your ~/.zimrc file to define the modules to be initialized. The initiali-
+zation will be done in the same order it's defined.
 
   <url>                      Module absolute path or repository URL. The following URL formats
                              are equivalent: foo, zimfw/foo, https://github.com/zimfw/foo.git.
-  -n|--name <module_name>    Set a custom module name. Default: the last component in <url>.
-                             Use slashes inside the name to organize the module into subdirec-
-                             tories.
+                             If an absolute path is given, the module is considered externally
+                             installed, and won't be installed or updated by zimfw.
+  -n|--name <module_name>    Set a custom module name. Use slashes inside the name to organize
+                             the module into subdirectories. The module will be installed at
+                             ${ZIM_HOME}/<module_name>. Default: the last component in <url>.
+  -r|--root <path>           Relative path to the module root.
 
-Repository options:
+Per-module options:
   -b|--branch <branch_name>  Use specified branch when installing and updating the module.
                              Overrides the tag option. Default: the repository default branch.
   -t|--tag <tag_name>        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.
   --no-submodules            Don't install or update git submodules.
   -z|--frozen                Don'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:
   --on-pull <command>        Execute command after installing or updating the module. The com-
                              mand is executed in the module root directory.
+  -d|--disabled              Don't initialize the module root or uninstall the module.
 
-Initialization options:
-  -f|--fpath <path>          Add specified path to fpath. The path is relative to the module
-                             root directory. Default: functions, if the subdirectory exists.
-  -a|--autoload <func_name>  Autoload specified function. Default: all valid names inside the
-                             functions subdirectory, if any.
-  -s|--source <file_path>    Source specified file. The file path is relative to the module
-                             root directory. Default: init.zsh, if the functions subdirectory
-                             also exists, or the largest of the files with name matching
-                             {init.zsh,module_name.{zsh,plugin.zsh,zsh-theme,sh}}, if any.
-  -c|--cmd <command>         Execute specified command. Occurrences of the {} placeholder in
-                             the command are substituted by the module root directory path.
+  The per-module-root options above are carried over multiple zmodule calls for the same mod-
+  ule root.
+
+Per-call initialization options:
+  -f|--fpath <path>          Will add specified path to fpath. The path is relative to the
+                             module root directory. Default: functions, if the subdirectory
+                             exists and is non-empty.
+  -a|--autoload <func_name>  Will autoload specified function. Default: all valid names inside
+                             the functions subdirectory, if any.
+  -s|--source <file_path>    Will source specified file. The path is relative to the module
+                             root directory. Default: init.zsh, if a non-empty functions sub-
+                             directory exists, else the largest of the files matching the glob
+                             (init.zsh|<root_tail>.(zsh|plugin.zsh|zsh-theme|sh)), if any.
+  -c|--cmd <command>         Will execute specified command. Occurrences of the {} placeholder
+                             in the command are substituted by the module root directory path.
                              I.e., -s 'foo.zsh' and -c 'source {}/foo.zsh' are equivalent.
-  -d|--disabled              Don't initialize or uninstall the module.
 
-  Setting any initialization option above will disable all the default values from the other
-  initialization options, so only your provided values are used. I.e. these values are either
-  all automatic, or all manual.
+  Setting any per-call initialization option above will disable the default values from the
+  other per-call initialization options, so only your provided values will be used. I.e. these
+  values are either all automatic, or all manual in each zmodule call. To use default values
+  and also provided values, use separate zmodule calls.
 
diff --git a/src/stage2/30_zmodule.zsh.erb b/src/stage2/30_zmodule.zsh.erb index 55a372c..d506f7d 100644 --- a/src/stage2/30_zmodule.zsh.erb +++ b/src/stage2/30_zmodule.zsh.erb @@ -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 %B${ZIM_HOME}/%b. Default: the last component in . - %B-r%b|%B--root%b Relative path to the module root. Default: none. + %B-r%b|%B--root%b Relative path to the module root. Per-module options: %B-b%b|%B--branch%b Use specified branch when installing and updating the module. diff --git a/src/zimfw.zsh.erb b/src/zimfw.zsh.erb index 34fec01..15b1528 100644 --- a/src/zimfw.zsh.erb +++ b/src/zimfw.zsh.erb @@ -4,7 +4,7 @@ class Zim :clear_line, :ellipsis, :okay, :warn, :error, :done, :failed def initialize - @version = "1.10.0-SNAPSHOT" + @version = "1.10.0" @home = "${ZDOTDIR:-${HOME}}" @min_zsh_version = "5.2" # Matches {ssh,http,https,git}://{user@,}host/org/repo and {user@,}host:org/repo diff --git a/zimfw.zsh b/zimfw.zsh index 130aa71..6cd1f2a 100644 --- a/zimfw.zsh +++ b/zimfw.zsh @@ -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 %B${ZIM_HOME}/%b. Default: the last component in . - %B-r%b|%B--root%b Relative path to the module root. Default: none. + %B-r%b|%B--root%b Relative path to the module root. Per-module options: %B-b%b|%B--branch%b Use specified branch when installing and updating the module. @@ -420,7 +420,7 @@ _zimfw_compile() { } _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 'TERM: '${TERM} print -R 'TERM_PROGRAM: '${TERM_PROGRAM} @@ -807,7 +807,7 @@ esac zimfw() { builtin emulate -L zsh -o EXTENDED_GLOB - local -r _zversion='1.10.0-SNAPSHOT' zusage="Usage: %B${0}%b [%B-q%b|%B-v%b] + local -r _zversion='1.10.0' zusage="Usage: %B${0}%b [%B-q%b|%B-v%b] Actions: %Bbuild%b Build %B${ZIM_HOME}/init.zsh%b and %B${ZIM_HOME}/login_init.zsh%b.