Update zmodule usage text

Hopefully the README.md will look aesthetically better with a pre block
instead of switching between text and `code`.
This commit is contained in:
Eric Nielsen 2020-05-02 18:47:38 -05:00
parent d1103f34e5
commit 7e369ef9cf
No known key found for this signature in database
GPG Key ID: 47D1DBFA0765A1FB
4 changed files with 70 additions and 46 deletions

View File

@ -81,35 +81,33 @@ Usage
### zmodule ### zmodule
Add `zmodule` calls to your `~/.zimrc` file to define the modules to be initialized. <pre>
The modules are initialized in the same order they are defined. Add: Usage: <strong>zmodule</strong> &lt;url&gt; [<strong>-n</strong>|<strong>--name</strong> &lt;module_name&gt;] [options]
zmodule <url> [-n|--name <module_name>] [options] Add <strong>zmodule</strong> calls to your <strong>~/.zimrc</strong> file to define the modules to be initialized. The modules are
initialized in the same order they are defined.
where `<url>` is the required repository URL or path. The following formats &lt;url&gt; Required repository URL or path. The following formats are
are equivalent: `name`, `zimfw/name`, `https://github.com/zimfw/name.git`. equivalent: <strong>name</strong>, <strong>zimfw/name</strong>, <strong>https://github.com/zimfw/name.git</strong>.
<strong>-n</strong>|<strong>--name</strong> &lt;module_name&gt; Set a custom module name. Default: the last component in the &lt;url&gt;.
By default, the module name is the last component in the `<url>`. Use the
`-n|--name <module_name>` option to set a custom module name.
Repository options: Repository options:
<strong>-b</strong>|<strong>--branch</strong> &lt;branch_name&gt; Use specified branch when installing and updating the module.
* `-b|--branch <branch_name>`: Use specified branch when installing and Overrides the tag option. Default: <strong>master</strong>.
updating the module. Overrides the tag option. Default: `master`. <strong>-t</strong>|<strong>--tag</strong> &lt;tag_name&gt; Use specified tag when installing and updating the module.
* `-t|--tag <tag_name>`: Use specified tag when installing and updating the Overrides the branch option.
module. Overrides the branch option. <strong>-z</strong>|<strong>--frozen</strong> Don't install or update the module.
* `-z|--frozen`: Don't install or update the module.
Initialization options: Initialization options:
<strong>-f</strong>|<strong>--fpath</strong> &lt;path&gt; Add specified path to fpath. The path is relative to the module
* `-f|--fpath <path>`: Add specified path to `fpath`. The path is relative to root directory. Default: <strong>functions</strong>, if the subdirectory exists.
the module root directory. Default: `functions`, if the subdirectory exists. <strong>-a</strong>|<strong>--autoload</strong> &lt;function_name&gt; Autoload specified function. Default: all valid names inside the
* `-a|--autoload <function_name>`: Autoload specified function. Default: all module's specified fpath paths.
valid names inside the module's specified `fpath` paths. <strong>-s</strong>|<strong>--source</strong> &lt;file_path&gt; Source specified file. The file path is relative to the module root
* `-s|--source <file_path>`: Source specified file. The file path is relative directory. Default: the file with largest size matching
to the module root directory. Default: the file with largest size matching <strong>{init.zsh,module_name.{zsh,plugin.zsh,zsh-theme,sh}}</strong>, if any exist.
`{init.zsh|module_name.{zsh|plugin.zsh|zsh-theme|sh}}`, if any exists. <strong>-d</strong>|<strong>--disabled</strong> Don't initialize or uninstall the module.
* `-d|--disabled`: Don't initialize or uninstall the module. </pre>
### zimfw ### zimfw

View File

@ -1,16 +1,29 @@
zmodule() { zmodule() {
local -r zusage="Usage: %B${0}%b <url> [%B-n%b|%B--name%b <module_name>] [options] local -r zusage="Usage: %B${0}%b <url> [%B-n%b|%B--name%b <module_name>] [options]
Repository options: Add %Bzmodule%b calls to your %B${ZDOTDIR:-${HOME}}/.zimrc%b file to define the modules to be initialized.
%B-b%b|%B--branch%b <branch_name> Use specified branch when installing and updating the module The modules are initialized in the same order they are defined.
%B-t%b|%B--tag%b <tag_name> Use specified tag when installing and updating the module
%B-z%b|%B--frozen%b Don't install or update the module
Startup options: <url> Required repository URL or path. The following formats are
%B-f%b|%B--fpath%b <path> Add specified path to fpath equivalent: %Bname%b, %Bzimfw/name%b, %Bhttps://github.com/zimfw/name.git%b.
%B-a%b|%B--autoload%b <function_name> Autoload specified function %B-n%b|%B--name%b <module_name> Set a custom module name. Default: the last component in the <url>.
%B-s%b|%B--source%b <file_path> Source specified file
%B-d%b|%B--disabled%b Don't initialize or uninstall the module Repository options:
%B-b%b|%B--branch%b <branch_name> Use specified branch when installing and updating the module.
Overrides the tag option. Default: %Bmaster%b.
%B-t%b|%B--tag%b <tag_name> 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 <path> 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 <function_name> Autoload specified function. Default: all valid names inside the
module's specified fpath paths.
%B-s%b|%B--source%b <file_path> 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 if [[ ${${funcfiletrace[1]%:*}:t} != .zimrc ]]; then
print -u2 -PR "%F{red}${0}: Must be called from %B<%= home %>/.zimrc%b%f"$'\n\n'${zusage} print -u2 -PR "%F{red}${0}: Must be called from %B<%= home %>/.zimrc%b%f"$'\n\n'${zusage}

View File

@ -3,7 +3,7 @@ zimfw() {
local -r zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b] local -r zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b]
Actions: 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%b Clean all (see below)
%Bclean-compiled%b Clean Zsh compiled files %Bclean-compiled%b Clean Zsh compiled files
%Bclean-dumpfile%b Clean completion dump file %Bclean-dumpfile%b Clean completion dump file
@ -13,7 +13,7 @@ Actions:
%Binstall%b Install new modules %Binstall%b Install new modules
%Buninstall%b Delete unused modules %Buninstall%b Delete unused modules
%Bupdate%b Update current modules %Bupdate%b Update current modules
%Bupgrade%b Upgrade zimfw.zsh %Bupgrade%b Upgrade %Bzimfw.zsh%b
%Bversion%b Print Zim version %Bversion%b Print Zim version
Options: Options:

View File

@ -101,16 +101,29 @@ _zimfw_build() {
zmodule() { zmodule() {
local -r zusage="Usage: %B${0}%b <url> [%B-n%b|%B--name%b <module_name>] [options] local -r zusage="Usage: %B${0}%b <url> [%B-n%b|%B--name%b <module_name>] [options]
Repository options: Add %Bzmodule%b calls to your %B${ZDOTDIR:-${HOME}}/.zimrc%b file to define the modules to be initialized.
%B-b%b|%B--branch%b <branch_name> Use specified branch when installing and updating the module The modules are initialized in the same order they are defined.
%B-t%b|%B--tag%b <tag_name> Use specified tag when installing and updating the module
%B-z%b|%B--frozen%b Don't install or update the module
Startup options: <url> Required repository URL or path. The following formats are
%B-f%b|%B--fpath%b <path> Add specified path to fpath equivalent: %Bname%b, %Bzimfw/name%b, %Bhttps://github.com/zimfw/name.git%b.
%B-a%b|%B--autoload%b <function_name> Autoload specified function %B-n%b|%B--name%b <module_name> Set a custom module name. Default: the last component in the <url>.
%B-s%b|%B--source%b <file_path> Source specified file
%B-d%b|%B--disabled%b Don't initialize or uninstall the module Repository options:
%B-b%b|%B--branch%b <branch_name> Use specified branch when installing and updating the module.
Overrides the tag option. Default: %Bmaster%b.
%B-t%b|%B--tag%b <tag_name> 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 <path> 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 <function_name> Autoload specified function. Default: all valid names inside the
module's specified fpath paths.
%B-s%b|%B--source%b <file_path> 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 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} 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() { _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 'ZIM_HOME: '${ZIM_HOME}
print -R 'Zsh version: '${ZSH_VERSION} print -R 'Zsh version: '${ZSH_VERSION}
print -R 'System info: '$(command uname -a) print -R 'System info: '$(command uname -a)
@ -329,7 +342,7 @@ zimfw() {
local -r zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b] local -r zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b]
Actions: 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%b Clean all (see below)
%Bclean-compiled%b Clean Zsh compiled files %Bclean-compiled%b Clean Zsh compiled files
%Bclean-dumpfile%b Clean completion dump file %Bclean-dumpfile%b Clean completion dump file
@ -339,7 +352,7 @@ Actions:
%Binstall%b Install new modules %Binstall%b Install new modules
%Buninstall%b Delete unused modules %Buninstall%b Delete unused modules
%Bupdate%b Update current modules %Bupdate%b Update current modules
%Bupgrade%b Upgrade zimfw.zsh %Bupgrade%b Upgrade %Bzimfw.zsh%b
%Bversion%b Print Zim version %Bversion%b Print Zim version
Options: Options: