From 281cde57f7626407c594fa80a72a35056f7f6067 Mon Sep 17 00:00:00 2001 From: Eric Nielsen <4120606+ericbn@users.noreply.github.com> Date: Sun, 18 Dec 2022 15:58:30 -0500 Subject: [PATCH] v1.11.0 --- CHANGELOG.md | 10 ++++++++++ README.md | 27 ++++++++++++++++++++++----- src/stage2/30_zmodule.zsh.erb | 2 ++ src/zimfw.zsh.erb | 2 +- zimfw.zsh | 6 ++++-- 5 files changed, 39 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca03aa2..c8d5c5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 _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 ### Added diff --git a/README.md b/README.md index 61f2973..fc333ce 100644 --- a/README.md +++ b/README.md @@ -222,15 +222,16 @@ Below are some usage examples:
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 initiali-
-zation will be done in the same order it's defined.
+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.
                              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>.
+  -n|--name <module_name>    Set a custom module name. Default: the last component in <url>.
+                             Slashes can be used inside the name to organize the module into
+                             subdirectories. The module will be installed at
+                             ${ZIM_HOME}/<module_name>.
   -r|--root <path>           Relative path to the module root.
 
 Per-module options:
@@ -252,6 +253,8 @@ Per-module options:
   Modules are uniquely identified by their name.
 
 Per-module-root options:
+  --if <test>                Will only initialize module root if specified test returns a zero
+                             exit status. The test is evaluated at every new terminal startup.
   --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.
@@ -268,7 +271,9 @@ Per-call initialization options:
   -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.
+                             (init.zsh|<name>.(zsh|plugin.zsh|zsh-theme|sh)), if any.
+                             <name> 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.
   -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.
@@ -293,6 +298,18 @@ The Zim plugin manager:
 
 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`
 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:
diff --git a/src/stage2/30_zmodule.zsh.erb b/src/stage2/30_zmodule.zsh.erb
index f549270..c36ab11 100644
--- a/src/stage2/30_zmodule.zsh.erb
+++ b/src/stage2/30_zmodule.zsh.erb
@@ -34,6 +34,8 @@ Per-module options:
   Modules are uniquely identified by their name.
 
 Per-module-root options:
+  %B--if%b                 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         Execute command after installing or updating the module. The com-
                              mand is executed in the module root directory.
   %B-d%b|%B--disabled%b              Don't initialize the module root or uninstall the module.
diff --git a/src/zimfw.zsh.erb b/src/zimfw.zsh.erb
index 19cc4fa..501cc15 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.11.0-SNAPSHOT"
+    @version = "1.11.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 fda3f1a..a1f20f1 100644
--- a/zimfw.zsh
+++ b/zimfw.zsh
@@ -148,6 +148,8 @@ Per-module options:
   Modules are uniquely identified by their name.
 
 Per-module-root options:
+  %B--if%b                 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         Execute command after installing or updating the module. The com-
                              mand is executed in the module root directory.
   %B-d%b|%B--disabled%b              Don't initialize the module root or uninstall the module.
@@ -455,7 +457,7 @@ _zimfw_compile() {
 }
 
 _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 'TERM:                 '${TERM}
   print -R 'TERM_PROGRAM:         '${TERM_PROGRAM}
@@ -842,7 +844,7 @@ esac
 
 zimfw() {
   builtin emulate -L zsh -o EXTENDED_GLOB
-  local -r _zversion='1.11.0-SNAPSHOT' zusage="Usage: %B${0}%b  [%B-q%b|%B-v%b]
+  local -r _zversion='1.11.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.