From 7e369ef9cf3fbdc334bc2baa01f093bd6ceee10a Mon Sep 17 00:00:00 2001 From: Eric Nielsen Date: Sat, 2 May 2020 18:47:38 -0500 Subject: [PATCH] Update zmodule usage text Hopefully the README.md will look aesthetically better with a pre block instead of switching between text and `code`. --- README.md | 44 +++++++++++++++++------------------ src/stage2/30_zmodule.zsh.erb | 31 +++++++++++++++++------- src/stage2/80_zimfw.zsh.erb | 4 ++-- zimfw.zsh | 37 +++++++++++++++++++---------- 4 files changed, 70 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 7340b94..85fbfbf 100644 --- a/README.md +++ b/README.md @@ -81,35 +81,33 @@ Usage ### zmodule -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: +
+Usage: zmodule <url> [-n|--name <module_name>] [options]
 
-    zmodule  [-n|--name ] [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.
 
-where `` is the required repository URL or path. The following formats
-are equivalent: `name`, `zimfw/name`, `https://github.com/zimfw/name.git`.
-
-By default, the module name is the last component in the ``. Use the
-`-n|--name ` option to set a custom module name.
+  <url>                          Required repository URL or path. The following formats are
+                                 equivalent: name, zimfw/name, https://github.com/zimfw/name.git.
+  -n|--name <module_name>        Set a custom module name. Default: the last component in the <url>.
 
 Repository options:
-
-* `-b|--branch `: Use specified branch when installing and
-  updating the module. Overrides the tag option. Default: `master`.
-* `-t|--tag `: Use specified tag when installing and updating the
-  module. Overrides the branch option.
-* `-z|--frozen`: Don't install or update the module.
+  -b|--branch <branch_name>      Use specified branch when installing and updating the module.
+                                 Overrides the tag option. Default: master.
+  -t|--tag <tag_name>            Use specified tag when installing and updating the module.
+                                 Overrides the branch option.
+  -z|--frozen                    Don't install or update the module.
 
 Initialization options:
-
-* `-f|--fpath `: Add specified path to `fpath`. The path is relative to
-  the module root directory. Default: `functions`, if the subdirectory exists.
-* `-a|--autoload `: Autoload specified function. Default: all
-  valid names inside the module's specified `fpath` paths.
-* `-s|--source `: Source specified file. The file path is relative
-  to the module root directory. Default: the file with largest size matching
-  `{init.zsh|module_name.{zsh|plugin.zsh|zsh-theme|sh}}`, if any exists.
-* `-d|--disabled`: Don't initialize or uninstall the module.
+  -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 <function_name>  Autoload specified function. Default: all valid names inside the
+                                 module's specified fpath paths.
+  -s|--source <file_path>        Source specified file. The file path is relative to the module root
+                                 directory. Default: the file with largest size matching
+                                 {init.zsh,module_name.{zsh,plugin.zsh,zsh-theme,sh}}, if any exist.
+  -d|--disabled                  Don't initialize or uninstall the module.
+
### zimfw diff --git a/src/stage2/30_zmodule.zsh.erb b/src/stage2/30_zmodule.zsh.erb index 86e9ce2..81c090e 100644 --- a/src/stage2/30_zmodule.zsh.erb +++ b/src/stage2/30_zmodule.zsh.erb @@ -1,16 +1,29 @@ zmodule() { local -r zusage="Usage: %B${0}%b [%B-n%b|%B--name%b ] [options] -Repository options: - %B-b%b|%B--branch%b Use specified branch when installing and updating the module - %B-t%b|%B--tag%b Use specified tag when installing and updating the module - %B-z%b|%B--frozen%b Don't install or update the module +Add %Bzmodule%b calls to your %B${ZDOTDIR:-${HOME}}/.zimrc%b file to define the modules to be initialized. +The modules are initialized in the same order they are defined. -Startup options: - %B-f%b|%B--fpath%b Add specified path to fpath - %B-a%b|%B--autoload%b Autoload specified function - %B-s%b|%B--source%b Source specified file - %B-d%b|%B--disabled%b Don't initialize or uninstall the module + Required repository URL or path. The following formats are + equivalent: %Bname%b, %Bzimfw/name%b, %Bhttps://github.com/zimfw/name.git%b. + %B-n%b|%B--name%b Set a custom module name. Default: the last component in the . + +Repository options: + %B-b%b|%B--branch%b Use specified branch when installing and updating the module. + Overrides the tag option. Default: %Bmaster%b. + %B-t%b|%B--tag%b Use specified tag when installing and updating the module. + Overrides the branch option. + %B-z%b|%B--frozen%b Don't install or update the module. + +Initialization options: + %B-f%b|%B--fpath%b Add specified path to fpath. The path is relative to the module + root directory. Default: %Bfunctions%b, if the subdirectory exists. + %B-a%b|%B--autoload%b Autoload specified function. Default: all valid names inside the + module's specified fpath paths. + %B-s%b|%B--source%b Source specified file. The file path is relative to the module root + directory. Default: the file with largest size matching + %B{init.zsh,module_name.{zsh,plugin.zsh,zsh-theme,sh}}%b, if any exist. + %B-d%b|%B--disabled%b Don't initialize or uninstall the module. " if [[ ${${funcfiletrace[1]%:*}:t} != .zimrc ]]; then print -u2 -PR "%F{red}${0}: Must be called from %B<%= home %>/.zimrc%b%f"$'\n\n'${zusage} diff --git a/src/stage2/80_zimfw.zsh.erb b/src/stage2/80_zimfw.zsh.erb index c6f7492..437f78b 100644 --- a/src/stage2/80_zimfw.zsh.erb +++ b/src/stage2/80_zimfw.zsh.erb @@ -3,7 +3,7 @@ zimfw() { local -r zusage="Usage: %B${0}%b [%B-q%b|%B-v%b] Actions: - %Bbuild%b Build init.zsh and login_init.zsh + %Bbuild%b Build %Binit.zsh%b and %Blogin_init.zsh%b %Bclean%b Clean all (see below) %Bclean-compiled%b Clean Zsh compiled files %Bclean-dumpfile%b Clean completion dump file @@ -13,7 +13,7 @@ Actions: %Binstall%b Install new modules %Buninstall%b Delete unused modules %Bupdate%b Update current modules - %Bupgrade%b Upgrade zimfw.zsh + %Bupgrade%b Upgrade %Bzimfw.zsh%b %Bversion%b Print Zim version Options: diff --git a/zimfw.zsh b/zimfw.zsh index 24b8062..aa8c555 100644 --- a/zimfw.zsh +++ b/zimfw.zsh @@ -101,16 +101,29 @@ _zimfw_build() { zmodule() { local -r zusage="Usage: %B${0}%b [%B-n%b|%B--name%b ] [options] -Repository options: - %B-b%b|%B--branch%b Use specified branch when installing and updating the module - %B-t%b|%B--tag%b Use specified tag when installing and updating the module - %B-z%b|%B--frozen%b Don't install or update the module +Add %Bzmodule%b calls to your %B${ZDOTDIR:-${HOME}}/.zimrc%b file to define the modules to be initialized. +The modules are initialized in the same order they are defined. -Startup options: - %B-f%b|%B--fpath%b Add specified path to fpath - %B-a%b|%B--autoload%b Autoload specified function - %B-s%b|%B--source%b Source specified file - %B-d%b|%B--disabled%b Don't initialize or uninstall the module + Required repository URL or path. The following formats are + equivalent: %Bname%b, %Bzimfw/name%b, %Bhttps://github.com/zimfw/name.git%b. + %B-n%b|%B--name%b Set a custom module name. Default: the last component in the . + +Repository options: + %B-b%b|%B--branch%b Use specified branch when installing and updating the module. + Overrides the tag option. Default: %Bmaster%b. + %B-t%b|%B--tag%b Use specified tag when installing and updating the module. + Overrides the branch option. + %B-z%b|%B--frozen%b Don't install or update the module. + +Initialization options: + %B-f%b|%B--fpath%b Add specified path to fpath. The path is relative to the module + root directory. Default: %Bfunctions%b, if the subdirectory exists. + %B-a%b|%B--autoload%b Autoload specified function. Default: all valid names inside the + module's specified fpath paths. + %B-s%b|%B--source%b Source specified file. The file path is relative to the module root + directory. Default: the file with largest size matching + %B{init.zsh,module_name.{zsh,plugin.zsh,zsh-theme,sh}}%b, if any exist. + %B-d%b|%B--disabled%b Don't initialize or uninstall the module. " if [[ ${${funcfiletrace[1]%:*}:t} != .zimrc ]]; then print -u2 -PR "%F{red}${0}: Must be called from %B${ZDOTDIR:-${HOME}}/.zimrc%b%f"$'\n\n'${zusage} @@ -281,7 +294,7 @@ _zimfw_compile() { } _zimfw_info() { - print -R 'zimfw version: '${_zversion}' (previous commit is 84976b0)' + print -R 'zimfw version: '${_zversion}' (previous commit is d1103f3)' print -R 'ZIM_HOME: '${ZIM_HOME} print -R 'Zsh version: '${ZSH_VERSION} print -R 'System info: '$(command uname -a) @@ -329,7 +342,7 @@ zimfw() { local -r zusage="Usage: %B${0}%b [%B-q%b|%B-v%b] Actions: - %Bbuild%b Build init.zsh and login_init.zsh + %Bbuild%b Build %Binit.zsh%b and %Blogin_init.zsh%b %Bclean%b Clean all (see below) %Bclean-compiled%b Clean Zsh compiled files %Bclean-dumpfile%b Clean completion dump file @@ -339,7 +352,7 @@ Actions: %Binstall%b Install new modules %Buninstall%b Delete unused modules %Bupdate%b Update current modules - %Bupgrade%b Upgrade zimfw.zsh + %Bupgrade%b Upgrade %Bzimfw.zsh%b %Bversion%b Print Zim version Options: