diff --git a/_zinit b/_zinit index 8a9a88f05..98d8514fc 100644 --- a/_zinit +++ b/_zinit @@ -36,6 +36,7 @@ __zinit_commands(){ 'env-whitelist:Specify names (also patterns) of parameters to be left unchanged during an unload' 'glance:Look at plugins source' 'help:Usage information' + 'ice:Set ice' 'load:Load plugin' 'man:Display Zinit'\''s manpage' 'module:Manage binary Zsh module shipped with Zinit' @@ -236,6 +237,11 @@ _zinit_env_whitelist(){ _zinit_glance(){ _arguments - installed '1:installed:__zinit_installed' && ret=0 } # ]]] +# FUNCTION: _zinit_ice [[[ +_zinit_ice(){ + _arguments -A \ + '(-h --help)'{-h,--help}'[Print usage]' && ret=0 +} # ]]] # FUNCTION: _zinit_list [[[ _zinit_list(){ _message 'Hit enter to list the defined key bindings replay' && ret=0 @@ -279,7 +285,7 @@ _zinit_snippet(){ _arguments -A \ '(-c --command)'{-c,--command}'[Load the snippet as a command (i.e., make executable and apend to $PATH])' \ '(-f --force)'{-f,--force}'[Force new download of the snippet file]' \ - '(-h --help)'{-h,--help}'[Show this help message]' + '(-h --help)'{-h,--help}'[Print usage]' _arguments - snippet '*::snippet:__zinit_installed_snippets' && ret=0 } # ]]] # FUNCTION: _zinit_status [[[ diff --git a/doc/zsdoc/zinit-additional.zsh.adoc b/doc/zsdoc/zinit-additional.zsh.adoc index c0364f1b9..ff537b9ae 100644 --- a/doc/zsdoc/zinit-additional.zsh.adoc +++ b/doc/zsdoc/zinit-additional.zsh.adoc @@ -53,9 +53,7 @@ Has 7 line(s). Calls functions: |-- zinit-autoload.zsh/.zinit-clear-report-for `-- zinit.zsh/+zi-log -Called by: - - zinit-autoload.zsh/.zinit-unload +Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). ==== .zinit-debug-report @@ -68,7 +66,6 @@ ____ Has 6 line(s). Calls functions: .zinit-debug-report - |-- zinit-autoload.zsh/.zinit-show-report `-- zinit.zsh/+zi-log Uses feature(s): _source_ @@ -86,7 +83,6 @@ ____ Has 7 line(s). Calls functions: .zinit-debug-revert - |-- zinit-autoload.zsh/.zinit-unload `-- zinit.zsh/+zi-log Uses feature(s): _source_ diff --git a/doc/zsdoc/zinit-autoload.zsh.adoc b/doc/zsdoc/zinit-autoload.zsh.adoc index f92ec7486..43f7d9e97 100644 --- a/doc/zsdoc/zinit-autoload.zsh.adoc +++ b/doc/zsdoc/zinit-autoload.zsh.adoc @@ -39,33 +39,13 @@ Documentation automatically generated with `zshelldoc' .zinit-get-path .zinit-glance .zinit-help - .zinit-list-bindkeys - .zinit-list-compdef-replay - .zinit-list-plugins - .zinit-list-snippets .zinit-module .zinit-pager .zinit-prepare-readlink - .zinit-prompt - .zinit-recall - .zinit-recently .zinit-restore-extendedglob - .zinit-run-delete-hooks .zinit-save-set-extendedglob - .zinit-search-completions - .zinit-self-update - .zinit-show-all-reports - .zinit-show-completions - .zinit-show-debug-report - .zinit-show-report - .zinit-show-times - .zinit-show-zstatus - .zinit-stress - .zinit-uncompile-plugin .zinit-uninstall-completions - .zinit-unload .zinit-unregister-plugin - .zinit-update-all-parallel .zinit-update-or-status .zinit-update-or-status-all .zinit-update-or-status-snippet @@ -269,9 +249,7 @@ ____ Has 11 line(s). Doesn't call other functions. -Called by: - - .zinit-show-report +Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). ==== .zinit-check-which-completions-are-installed @@ -288,9 +266,7 @@ ____ Has 12 line(s). Doesn't call other functions. -Called by: - - .zinit-show-report +Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). ==== .zinit-clear-completions @@ -339,7 +315,6 @@ Has 23 line(s). Calls functions: Called by: - .zinit-unload zinit-additional.zsh/.zinit-debug-clear ==== .zinit-compile-uncompile-all @@ -355,9 +330,6 @@ ____ Has 23 line(s). Calls functions: .zinit-compile-uncompile-all - |-- .zinit-uncompile-plugin - |   |-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 - |   `-- zinit.zsh/.zinit-any-to-user-plugin |-- zinit-install.zsh/.zinit-compile-plugin |-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 `-- zinit.zsh/.zinit-any-to-user-plugin @@ -448,9 +420,6 @@ ____ Has 111 line(s). Calls functions: .zinit-delete - |-- .zinit-prompt - |-- .zinit-run-delete-hooks - |   `-- zinit-side.zsh/.zinit-countdown |-- zinit-side.zsh/.zinit-compute-ice |-- zinit.zsh/+zinit-message |-- zinit.zsh/.zinit-any-to-user-plugin @@ -477,10 +446,7 @@ Has 30 line(s). Doesn't call other functions. Uses feature(s): _setopt_ -Called by: - - .zinit-show-report - .zinit-unload +Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). ==== .zinit-diff-functions-compute @@ -497,10 +463,7 @@ Has 19 line(s). Doesn't call other functions. Uses feature(s): _setopt_ -Called by: - - .zinit-show-report - .zinit-unload +Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). ==== .zinit-diff-options-compute @@ -517,10 +480,7 @@ Has 17 line(s). Doesn't call other functions. Uses feature(s): _setopt_ -Called by: - - .zinit-show-report - .zinit-unload +Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). ==== .zinit-diff-parameter-compute @@ -538,10 +498,7 @@ Has 28 line(s). Doesn't call other functions. Uses feature(s): _setopt_ -Called by: - - .zinit-show-report - .zinit-unload +Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). ==== .zinit-edit @@ -583,10 +540,7 @@ Has 7 line(s). Calls functions: |   `-- zinit.zsh/.zinit-any-to-user-plugin `-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 -Called by: - - .zinit-show-report - .zinit-unload +Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). ==== .zinit-find-completions-of-plugin @@ -607,9 +561,7 @@ Has 6 line(s). Calls functions: Uses feature(s): _setopt_ -Called by: - - .zinit-show-report +Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). ==== .zinit-format-env @@ -625,9 +577,7 @@ ____ Has 16 line(s). Doesn't call other functions. -Called by: - - .zinit-show-report +Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). ==== .zinit-format-functions @@ -642,9 +592,7 @@ ____ Has 36 line(s). Doesn't call other functions. -Called by: - - .zinit-show-report +Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). ==== .zinit-format-options @@ -663,9 +611,7 @@ Has 21 line(s). Calls functions: |-- .zinit-restore-extendedglob `-- .zinit-save-set-extendedglob -Called by: - - .zinit-show-report +Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). ==== .zinit-format-parameter @@ -682,9 +628,7 @@ Has 35 line(s). Doesn't call other functions. Uses feature(s): _setopt_ -Called by: - - .zinit-show-report +Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). ==== .zinit-get-completion-owner @@ -713,7 +657,6 @@ Called by: .zinit-clear-completions .zinit-get-completion-owner-uspl2col - .zinit-show-completions ==== .zinit-get-completion-owner-uspl2col @@ -796,65 +739,7 @@ ____ ____ -Has 64 line(s). Doesn't call other functions. - -Called by: - - zinit.zsh/zinit - -==== .zinit-list-bindkeys - -Has 44 line(s). Calls functions: - - .zinit-list-bindkeys - `-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 - -Called by: - - zinit.zsh/zinit - -==== .zinit-list-compdef-replay - -____ - - Shows recorded compdefs (called by plugins loaded earlier). - Plugins often call `compdef' hoping for `compinit' being - already ran. Zinit solves this by recording compdefs. - - User-action entry point. - -____ - -Has 5 line(s). Doesn't call other functions. - -Called by: - - zinit.zsh/zinit - -==== .zinit-list-plugins - -____ - - Lists loaded plugins (subcommands list, lodaded) - -____ - -Has 21 line(s). Calls functions: - - .zinit-list-plugins - `-- zinit.zsh/+zinit-message - -Uses feature(s): _setopt_ - -Called by: - - zinit.zsh/zinit - -==== .zinit-list-snippets - -Has 20 line(s). Doesn't call other functions. - -Uses feature(s): _setopt_ +Has 1416 line(s). Doesn't call other functions. Called by: @@ -897,7 +782,6 @@ Uses feature(s): _setopt_ Called by: .zinit-glance - .zinit-self-update .zinit-update-or-status ==== .zinit-prepare-readlink @@ -919,62 +803,6 @@ Called by: .zinit-cdisable .zinit-cenable .zinit-clear-completions - .zinit-show-completions - -==== .zinit-prompt - -____ - - Prompt user to confirm - - $1 - prompt - - $REPLY - 0 or 1 - -____ - -Has 4 line(s). Doesn't call other functions. - -Uses feature(s): _read_ - -Called by: - - .zinit-delete - -==== .zinit-recall - -Has 38 line(s). Calls functions: - - .zinit-recall - |-- zinit-side.zsh/.zinit-compute-ice - `-- zinit.zsh/+zinit-deploy-message - -Uses feature(s): _setopt_ - -Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). - -==== .zinit-recently - -____ - - Shows plugins that obtained commits in specified past time. - - User-action entry point. - - $1 - time spec, e.g. "1 week" - -____ - -Has 28 line(s). Calls functions: - - .zinit-recently - `-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 - -Uses feature(s): _setopt_ - -Called by: - - zinit.zsh/zinit ==== .zinit-restore-extendedglob @@ -991,20 +819,6 @@ Uses feature(s): _setopt_ Called by: .zinit-format-options - .zinit-unload - -==== .zinit-run-delete-hooks - -Has 17 line(s). Calls functions: - - .zinit-run-delete-hooks - `-- zinit-side.zsh/.zinit-countdown - -Uses feature(s): _eval_ - -Called by: - - .zinit-delete ==== .zinit-save-set-extendedglob @@ -1022,293 +836,6 @@ Uses feature(s): _setopt_ Called by: .zinit-format-options - .zinit-unload - -==== .zinit-search-completions - -____ - - While .zinit-show-completions() shows what completions are - installed, this functions searches through all plugin dirs - showing what's available in general (for installation). - - User-action entry point. - -____ - -Has 43 line(s). Calls functions: - - .zinit-search-completions - `-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 - -Uses feature(s): _setopt_ - -Called by: - - zinit.zsh/zinit - -==== .zinit-self-update - -____ - - Updates Zinit code (does a git pull) - -____ - -Has 42 line(s). Calls functions: - - .zinit-self-update - |-- .zinit-pager - |-- zinit.zsh/+zinit-message - `-- zinit.zsh/.zinit-get-mtime-into - -Uses feature(s): _setopt_, _source_, _zcompile_ - -Called by: - - .zinit-update-or-status-all - zinit.zsh/zinit - -==== .zinit-show-all-reports - -____ - - Displays reports of all loaded plugins. - - User-action entry point. - -____ - -Has 5 line(s). Calls functions: - - .zinit-show-all-reports - `-- .zinit-show-report - |-- .zinit-check-which-completions-are-enabled - |-- .zinit-check-which-completions-are-installed - |-- .zinit-diff-env-compute - |-- .zinit-diff-functions-compute - |-- .zinit-diff-options-compute - |-- .zinit-diff-parameter-compute - |-- .zinit-exists-message - |   |-- .zinit-any-to-uspl2 - |   |   `-- zinit.zsh/.zinit-any-to-user-plugin - |   `-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 - |-- .zinit-find-completions-of-plugin - |   `-- zinit.zsh/.zinit-any-to-user-plugin - |-- .zinit-format-env - |-- .zinit-format-functions - |-- .zinit-format-options - |   |-- .zinit-restore-extendedglob - |   `-- .zinit-save-set-extendedglob - |-- .zinit-format-parameter - `-- zinit.zsh/.zinit-any-to-user-plugin - -Called by: - - zinit.zsh/zinit - -==== .zinit-show-completions - -____ - - Display installed (enabled and disabled), completions. Detect - stray and improper ones. - - Completions live even when plugin isn't loaded - if they are - installed and enabled. - - User-action entry point. - -____ - -Has 72 line(s). Calls functions: - - .zinit-show-completions - |-- .zinit-get-completion-owner - |-- .zinit-prepare-readlink - `-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 - -Uses feature(s): _setopt_ - -Called by: - - zinit.zsh/zinit - -==== .zinit-show-debug-report - -____ - - Displays dtrace report (data recorded in interactive session). - - User-action entry point. - -____ - -Has 1 line(s). Calls functions: - - .zinit-show-debug-report - `-- .zinit-show-report - |-- .zinit-check-which-completions-are-enabled - |-- .zinit-check-which-completions-are-installed - |-- .zinit-diff-env-compute - |-- .zinit-diff-functions-compute - |-- .zinit-diff-options-compute - |-- .zinit-diff-parameter-compute - |-- .zinit-exists-message - |   |-- .zinit-any-to-uspl2 - |   |   `-- zinit.zsh/.zinit-any-to-user-plugin - |   `-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 - |-- .zinit-find-completions-of-plugin - |   `-- zinit.zsh/.zinit-any-to-user-plugin - |-- .zinit-format-env - |-- .zinit-format-functions - |-- .zinit-format-options - |   |-- .zinit-restore-extendedglob - |   `-- .zinit-save-set-extendedglob - |-- .zinit-format-parameter - `-- zinit.zsh/.zinit-any-to-user-plugin - -Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). - -==== .zinit-show-report - -____ - - Displays report of the plugin given. - - $1 - plugin spec (4 formats: user---plugin, user/plugin, user (+ plugin in $2), plugin) - $2 - plugin (only when $1 - i.e. user - given) - -____ - -Has 71 line(s). Calls functions: - - .zinit-show-report - |-- .zinit-check-which-completions-are-enabled - |-- .zinit-check-which-completions-are-installed - |-- .zinit-diff-env-compute - |-- .zinit-diff-functions-compute - |-- .zinit-diff-options-compute - |-- .zinit-diff-parameter-compute - |-- .zinit-exists-message - |   |-- .zinit-any-to-uspl2 - |   |   `-- zinit.zsh/.zinit-any-to-user-plugin - |   `-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 - |-- .zinit-find-completions-of-plugin - |   `-- zinit.zsh/.zinit-any-to-user-plugin - |-- .zinit-format-env - |-- .zinit-format-functions - |-- .zinit-format-options - |   |-- .zinit-restore-extendedglob - |   `-- .zinit-save-set-extendedglob - |-- .zinit-format-parameter - `-- zinit.zsh/.zinit-any-to-user-plugin - -Uses feature(s): _setopt_ - -Called by: - - .zinit-show-all-reports - .zinit-show-debug-report - zinit-additional.zsh/.zinit-debug-report - zinit.zsh/zinit - -==== .zinit-show-times - -____ - - Shows loading times of all loaded plugins. - - User-action entry point. - -____ - -Has 65 line(s). Calls functions: - - .zinit-show-times - `-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 - -Uses feature(s): _setopt_ - -Called by: - - zinit.zsh/zinit - -==== .zinit-show-zstatus - -____ - - Shows Zinit status, i.e. number of loaded plugins, - of available completions, etc. - - User-action entry point. - -____ - -Has 47 line(s). Calls functions: - - .zinit-show-zstatus - `-- zinit.zsh/+zinit-message - -Uses feature(s): _setopt_ - -Called by: - - zinit.zsh/zinit - -==== .zinit-stress - -____ - - Compiles plugin with various options on and off to see - how well the code is written. The options are: - - NO_SHORT_LOOPS, IGNORE_BRACES, IGNORE_CLOSE_BRACES, SH_GLOB, - CSH_JUNKIE_QUOTES, NO_MULTI_FUNC_DEF. - - User-action entry point. - - $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin) - $2 - plugin (only when $1 - i.e. user - given) - -____ - -Has 38 line(s). Calls functions: - - .zinit-stress - |-- zinit-side.zsh/.zinit-exists-physically-message - |-- zinit-side.zsh/.zinit-first - `-- zinit.zsh/.zinit-any-to-user-plugin - -Uses feature(s): _setopt_, _zcompile_ - -Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). - -==== .zinit-uncompile-plugin - -____ - - Uncompiles given plugin. - - User-action entry point. - - $1 - plugin spec (4 formats: user---plugin, user/plugin, user (+ plugin in $2), plugin) - $2 - plugin (only when $1 - i.e. user - given) - -____ - -Has 22 line(s). Calls functions: - - .zinit-uncompile-plugin - |-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 - `-- zinit.zsh/.zinit-any-to-user-plugin - -Uses feature(s): _setopt_ - -Called by: - - .zinit-compile-uncompile-all - zinit.zsh/zinit ==== .zinit-uninstall-completions @@ -1337,58 +864,6 @@ Called by: zinit.zsh/zinit -==== .zinit-unload - -____ - - 1. call the zsh plugin's standard *_plugin_unload function - 2. call the code provided by the zsh plugin's standard @zsh-plugin-run-at-update - 3. delete bindkeys (...) - 4. delete zstyles - 5. restore options - 6. remove aliases - 7. restore zle state - 8. unfunction functions (created by plugin) - 9. clean-up fpath and path - 10. delete created variables - 11. forget the plugin - - $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin) - $2 - plugin (only when $1 - i.e. user - given) - -____ - -Has 385 line(s). Calls functions: - - .zinit-unload - |-- .zinit-clear-report-for - |   `-- .zinit-any-to-uspl2 - |   `-- zinit.zsh/.zinit-any-to-user-plugin - |-- .zinit-diff-env-compute - |-- .zinit-diff-functions-compute - |-- .zinit-diff-options-compute - |-- .zinit-diff-parameter-compute - |-- .zinit-exists-message - |   |-- .zinit-any-to-uspl2 - |   |   `-- zinit.zsh/.zinit-any-to-user-plugin - |   `-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 - |-- .zinit-restore-extendedglob - |-- .zinit-save-set-extendedglob - |-- .zinit-unregister-plugin - |   `-- zinit.zsh/.zinit-any-to-user-plugin - |-- zinit-additional.zsh/.zinit-debug-clear - |-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 - |-- zinit.zsh/+zi-log - `-- zinit.zsh/.zinit-any-to-user-plugin - -Uses feature(s): _alias_, _bindkey_, _eval_, _setopt_, _unalias_, _unfunction_, _zle_, _zstyle_ - -Called by: - - zinit-additional.zsh/.zinit-debug-revert - zinit.zsh/.zinit-run-task - zinit.zsh/zinit - ==== .zinit-unregister-plugin ____ @@ -1403,45 +878,7 @@ Has 6 line(s). Calls functions: .zinit-unregister-plugin `-- zinit.zsh/.zinit-any-to-user-plugin -Called by: - - .zinit-unload - -==== .zinit-update-all-parallel - -Has 84 line(s). Calls functions: - - .zinit-update-all-parallel - |-- .zinit-update-or-status - |   |-- .zinit-pager - |   |-- .zinit-update-or-status-snippet - |   |   |-- zinit-install.zsh/.zinit-update-snippet - |   |   `-- zinit-side.zsh/.zinit-compute-ice - |   |-- zinit-install.zsh/.zinit-get-latest-gh-r-url-part - |   |-- zinit-install.zsh/.zinit-setup-plugin-dir - |   |-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 - |   |-- zinit-side.zsh/.zinit-compute-ice - |   |-- zinit-side.zsh/.zinit-exists-physically - |   |-- zinit-side.zsh/.zinit-exists-physically-message - |   |-- zinit-side.zsh/.zinit-store-ices - |   |-- zinit-side.zsh/.zinit-two-paths - |   |-- zinit.zsh/+zinit-message - |   |-- zinit.zsh/.zinit-any-to-user-plugin - |   `-- zinit.zsh/.zinit-set-m-func - |-- .zinit-update-or-status-snippet - |   |-- zinit-install.zsh/.zinit-update-snippet - |   `-- zinit-side.zsh/.zinit-compute-ice - |-- .zinit-wait-for-update-jobs - |   `-- zinit.zsh/+zinit-message - |-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 - |-- zinit.zsh/+zinit-message - `-- zinit.zsh/.zinit-any-to-user-plugin - -Uses feature(s): _setopt_ - -Called by: - - .zinit-update-or-status-all +Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). ==== .zinit-update-or-status @@ -1480,7 +917,6 @@ Uses feature(s): _kill_, _read_, _setopt_, _source_, _trap_, _wait_ Called by: - .zinit-update-all-parallel .zinit-update-or-status-all zinit.zsh/zinit @@ -1499,35 +935,6 @@ ____ Has 133 line(s). Calls functions: .zinit-update-or-status-all - |-- .zinit-self-update - |   |-- .zinit-pager - |   |-- zinit.zsh/+zinit-message - |   `-- zinit.zsh/.zinit-get-mtime-into - |-- .zinit-update-all-parallel - |   |-- .zinit-update-or-status - |   |   |-- .zinit-pager - |   |   |-- .zinit-update-or-status-snippet - |   |   |   |-- zinit-install.zsh/.zinit-update-snippet - |   |   |   `-- zinit-side.zsh/.zinit-compute-ice - |   |   |-- zinit-install.zsh/.zinit-get-latest-gh-r-url-part - |   |   |-- zinit-install.zsh/.zinit-setup-plugin-dir - |   |   |-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 - |   |   |-- zinit-side.zsh/.zinit-compute-ice - |   |   |-- zinit-side.zsh/.zinit-exists-physically - |   |   |-- zinit-side.zsh/.zinit-exists-physically-message - |   |   |-- zinit-side.zsh/.zinit-store-ices - |   |   |-- zinit-side.zsh/.zinit-two-paths - |   |   |-- zinit.zsh/+zinit-message - |   |   |-- zinit.zsh/.zinit-any-to-user-plugin - |   |   `-- zinit.zsh/.zinit-set-m-func - |   |-- .zinit-update-or-status-snippet - |   |   |-- zinit-install.zsh/.zinit-update-snippet - |   |   `-- zinit-side.zsh/.zinit-compute-ice - |   |-- .zinit-wait-for-update-jobs - |   |   `-- zinit.zsh/+zinit-message - |   |-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 - |   |-- zinit.zsh/+zinit-message - |   `-- zinit.zsh/.zinit-any-to-user-plugin |-- .zinit-update-or-status |   |-- .zinit-pager |   |-- .zinit-update-or-status-snippet @@ -1581,7 +988,6 @@ Uses feature(s): _source_ Called by: - .zinit-update-all-parallel .zinit-update-or-status-all .zinit-update-or-status @@ -1594,9 +1000,7 @@ Has 18 line(s). Calls functions: Uses feature(s): _wait_ -Called by: - - .zinit-update-all-parallel +Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). ==== zi::version diff --git a/doc/zsdoc/zinit-install.zsh.adoc b/doc/zsdoc/zinit-install.zsh.adoc index a47515c73..f90c1d8bd 100644 --- a/doc/zsdoc/zinit-install.zsh.adoc +++ b/doc/zsdoc/zinit-install.zsh.adoc @@ -302,10 +302,10 @@ Has 195 line(s). Calls functions: |-- .zinit-download-file-stdout |   `-- zinit.zsh/+zinit-message |-- .zinit-jq-check - |   `-- zinit.zsh/+zinit-message + |   `-- zinit.zsh/+zi-log |-- .zinit-json-to-array |   `-- .zinit-jq-check - |   `-- zinit.zsh/+zinit-message + |   `-- zinit.zsh/+zi-log |-- ziextract |   `-- zinit.zsh/+zinit-message |-- zinit.zsh/+zinit-message @@ -379,10 +379,10 @@ ____ ____ -Has 8 line(s). Calls functions: +Has 3 line(s). Calls functions: .zinit-jq-check - `-- zinit.zsh/+zinit-message + `-- zinit.zsh/+zi-log Called by: @@ -405,7 +405,7 @@ Has 4 line(s). Calls functions: .zinit-json-get-value `-- .zinit-jq-check - `-- zinit.zsh/+zinit-message + `-- zinit.zsh/+zi-log Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). @@ -426,7 +426,7 @@ Has 13 line(s). Calls functions: .zinit-json-to-array `-- .zinit-jq-check - `-- zinit.zsh/+zinit-message + `-- zinit.zsh/+zi-log Uses feature(s): _eval_, _setopt_ diff --git a/doc/zsdoc/zinit-side.zsh.adoc b/doc/zsdoc/zinit-side.zsh.adoc index a9b3378c4..84a70bceb 100644 --- a/doc/zsdoc/zinit-side.zsh.adoc +++ b/doc/zsdoc/zinit-side.zsh.adoc @@ -50,14 +50,6 @@ Called by: zinit-autoload.zsh/.zinit-create zinit-autoload.zsh/.zinit-exists-message zinit-autoload.zsh/.zinit-get-completion-owner-uspl2col - zinit-autoload.zsh/.zinit-list-bindkeys - zinit-autoload.zsh/.zinit-recently - zinit-autoload.zsh/.zinit-search-completions - zinit-autoload.zsh/.zinit-show-completions - zinit-autoload.zsh/.zinit-show-times - zinit-autoload.zsh/.zinit-uncompile-plugin - zinit-autoload.zsh/.zinit-unload - zinit-autoload.zsh/.zinit-update-all-parallel zinit-autoload.zsh/.zinit-update-or-status-all zinit-autoload.zsh/.zinit-update-or-status zinit-install.zsh/.zinit-install-completions @@ -118,7 +110,6 @@ Called by: zinit-autoload.zsh/.zinit-delete zinit-autoload.zsh/.zinit-edit - zinit-autoload.zsh/.zinit-recall zinit-autoload.zsh/.zinit-update-or-status-snippet zinit-autoload.zsh/.zinit-update-or-status zinit-install.zsh/.zinit-compile-plugin @@ -142,7 +133,6 @@ Uses feature(s): _trap_ Called by: - zinit-autoload.zsh/.zinit-run-delete-hooks zinit-install.zsh/.zinit-configure-run-autoconf zinit-install.zsh/∞zinit-atclone-hook zinit-install.zsh/∞zinit-atpull-e-hook @@ -203,7 +193,6 @@ Called by: .zinit-compute-ice zinit-autoload.zsh/.zinit-changes zinit-autoload.zsh/.zinit-glance - zinit-autoload.zsh/.zinit-stress zinit-autoload.zsh/.zinit-update-or-status zinit-install.zsh/.zinit-install-completions @@ -234,7 +223,6 @@ Called by: .zinit-two-paths zinit-autoload.zsh/.zinit-glance - zinit-autoload.zsh/.zinit-stress zinit-install.zsh/.zinit-compile-plugin ==== .zinit-store-ices diff --git a/doc/zsdoc/zinit.zsh.adoc b/doc/zsdoc/zinit.zsh.adoc index e880a8ae6..62d7508c9 100644 --- a/doc/zsdoc/zinit.zsh.adoc +++ b/doc/zsdoc/zinit.zsh.adoc @@ -110,6 +110,8 @@ Has 244 line(s). Calls functions: |   |-- .zinit-get-object-path |   |   `-- .zinit-any-to-user-plugin |   |-- .zinit-ice + |   |   `-- +zi-log + |   |   `-- +zinit-message |   |-- .zinit-load-ices |   |   `-- .zinit-get-object-path |   |   `-- .zinit-any-to-user-plugin @@ -181,22 +183,8 @@ Has 244 line(s). Calls functions: |   |-- zinit-autoload.zsh/.zinit-compiled |   |-- zinit-autoload.zsh/.zinit-delete |   |-- zinit-autoload.zsh/.zinit-help - |   |-- zinit-autoload.zsh/.zinit-list-bindkeys - |   |-- zinit-autoload.zsh/.zinit-list-compdef-replay - |   |-- zinit-autoload.zsh/.zinit-list-plugins - |   |-- zinit-autoload.zsh/.zinit-list-snippets |   |-- zinit-autoload.zsh/.zinit-module - |   |-- zinit-autoload.zsh/.zinit-recently - |   |-- zinit-autoload.zsh/.zinit-search-completions - |   |-- zinit-autoload.zsh/.zinit-self-update - |   |-- zinit-autoload.zsh/.zinit-show-all-reports - |   |-- zinit-autoload.zsh/.zinit-show-completions - |   |-- zinit-autoload.zsh/.zinit-show-report - |   |-- zinit-autoload.zsh/.zinit-show-times - |   |-- zinit-autoload.zsh/.zinit-show-zstatus - |   |-- zinit-autoload.zsh/.zinit-uncompile-plugin |   |-- zinit-autoload.zsh/.zinit-uninstall-completions - |   |-- zinit-autoload.zsh/.zinit-unload |   |-- zinit-autoload.zsh/.zinit-update-or-status |   |-- zinit-autoload.zsh/.zinit-update-or-status-all |   |-- zinit-autoload.zsh/zi::version @@ -225,6 +213,7 @@ Has 1 line(s). Calls functions: Called by: + .zinit-ice zinit-additional.zsh/.zinit-debug-clear zinit-additional.zsh/.zinit-debug-report zinit-additional.zsh/.zinit-debug-revert @@ -232,7 +221,7 @@ Called by: zinit-additional.zsh/.zinit-debug-status zinit-additional.zsh/.zinit-debug-stop zinit-additional.zsh/:zinit-tmp-subst-source - zinit-autoload.zsh/.zinit-unload + zinit-install.zsh/.zinit-jq-check ==== +zinit-deploy-message @@ -251,7 +240,6 @@ Called by: .zinit-load-snippet .zinit-load - zinit-autoload.zsh/.zinit-recall ==== +zinit-message @@ -281,11 +269,7 @@ Called by: zinit-autoload.zsh/.zinit-confirm zinit-autoload.zsh/.zinit-delete zinit-autoload.zsh/.zinit-glance - zinit-autoload.zsh/.zinit-list-plugins - zinit-autoload.zsh/.zinit-self-update - zinit-autoload.zsh/.zinit-show-zstatus zinit-autoload.zsh/.zinit-uninstall-completions - zinit-autoload.zsh/.zinit-update-all-parallel zinit-autoload.zsh/.zinit-update-or-status-all zinit-autoload.zsh/.zinit-update-or-status zinit-autoload.zsh/.zinit-wait-for-update-jobs @@ -300,7 +284,6 @@ Called by: zinit-install.zsh/.zinit-get-latest-gh-r-url-part zinit-install.zsh/.zinit-get-package zinit-install.zsh/.zinit-install-completions - zinit-install.zsh/.zinit-jq-check zinit-install.zsh/.zinit-setup-plugin-dir zinit-install.zsh/.zinit-update-snippet zinit-install.zsh/ziextract @@ -417,12 +400,7 @@ Called by: zinit-autoload.zsh/.zinit-delete zinit-autoload.zsh/.zinit-find-completions-of-plugin zinit-autoload.zsh/.zinit-glance - zinit-autoload.zsh/.zinit-show-report - zinit-autoload.zsh/.zinit-stress - zinit-autoload.zsh/.zinit-uncompile-plugin - zinit-autoload.zsh/.zinit-unload zinit-autoload.zsh/.zinit-unregister-plugin - zinit-autoload.zsh/.zinit-update-all-parallel zinit-autoload.zsh/.zinit-update-or-status-all zinit-autoload.zsh/.zinit-update-or-status zinit-install.zsh/.zinit-install-completions @@ -658,7 +636,6 @@ Has 7 line(s). Doesn't call other functions. Called by: Script-Body - zinit-autoload.zsh/.zinit-self-update zinit-autoload.zsh/.zinit-update-or-status-all ==== .zinit-get-object-path @@ -690,9 +667,13 @@ ____ ____ -Has 13 line(s). Doesn't call other functions. +Has 32 line(s). Calls functions: -Uses feature(s): _setopt_ + .zinit-ice + `-- +zi-log + `-- +zinit-message + +Uses feature(s): _setopt_, _zmodload_, _zparseopts_ Called by: @@ -1062,19 +1043,18 @@ Has 47 line(s). Calls functions: |   |-- .zinit-setup-params |   |-- zinit-install.zsh/.zinit-get-package |   `-- zinit-install.zsh/.zinit-setup-plugin-dir - |-- .zinit-load-snippet - |   |-- +zinit-deploy-message - |   |-- +zinit-message - |   |-- .zinit-add-report - |   |-- .zinit-find-other-matches - |   |-- .zinit-get-object-path - |   |   `-- .zinit-any-to-user-plugin - |   |-- .zinit-pack-ice - |   |-- .zinit-set-m-func - |   |   `-- +zinit-message - |   |-- .zinit-setup-params - |   `-- zinit-install.zsh/.zinit-download-snippet - `-- zinit-autoload.zsh/.zinit-unload + `-- .zinit-load-snippet + |-- +zinit-deploy-message + |-- +zinit-message + |-- .zinit-add-report + |-- .zinit-find-other-matches + |-- .zinit-get-object-path + |   `-- .zinit-any-to-user-plugin + |-- .zinit-pack-ice + |-- .zinit-set-m-func + |   `-- +zinit-message + |-- .zinit-setup-params + `-- zinit-install.zsh/.zinit-download-snippet Uses feature(s): _eval_, _source_, _zle_, _zpty_ @@ -1438,19 +1418,18 @@ Has 75 line(s). *Is a precmd hook*. Calls functions: |   |   |-- .zinit-setup-params |   |   |-- zinit-install.zsh/.zinit-get-package |   |   `-- zinit-install.zsh/.zinit-setup-plugin-dir - |   |-- .zinit-load-snippet - |   |   |-- +zinit-deploy-message - |   |   |-- +zinit-message - |   |   |-- .zinit-add-report - |   |   |-- .zinit-find-other-matches - |   |   |-- .zinit-get-object-path - |   |   |   `-- .zinit-any-to-user-plugin - |   |   |-- .zinit-pack-ice - |   |   |-- .zinit-set-m-func - |   |   |   `-- +zinit-message - |   |   |-- .zinit-setup-params - |   |   `-- zinit-install.zsh/.zinit-download-snippet - |   `-- zinit-autoload.zsh/.zinit-unload + |   `-- .zinit-load-snippet + |   |-- +zinit-deploy-message + |   |-- +zinit-message + |   |-- .zinit-add-report + |   |-- .zinit-find-other-matches + |   |-- .zinit-get-object-path + |   |   `-- .zinit-any-to-user-plugin + |   |-- .zinit-pack-ice + |   |-- .zinit-set-m-func + |   |   `-- +zinit-message + |   |-- .zinit-setup-params + |   `-- zinit-install.zsh/.zinit-download-snippet `-- add-zsh-hook Uses feature(s): _add-zsh-hook_, _sched_, _setopt_, _zle_ @@ -1600,10 +1579,11 @@ ____ Entrypoint function directly exposed to user, consumes subcommands with respective arguments, and completion. + ____ -Has 553 line(s). Calls functions: +Has 527 line(s). Calls functions: zinit |-- +zinit-message @@ -1618,6 +1598,8 @@ Has 553 line(s). Calls functions: |-- .zinit-get-object-path |   `-- .zinit-any-to-user-plugin |-- .zinit-ice + |   `-- +zi-log + |   `-- +zinit-message |-- .zinit-load-ices |   `-- .zinit-get-object-path |   `-- .zinit-any-to-user-plugin @@ -1689,22 +1671,8 @@ Has 553 line(s). Calls functions: |-- zinit-autoload.zsh/.zinit-compiled |-- zinit-autoload.zsh/.zinit-delete |-- zinit-autoload.zsh/.zinit-help - |-- zinit-autoload.zsh/.zinit-list-bindkeys - |-- zinit-autoload.zsh/.zinit-list-compdef-replay - |-- zinit-autoload.zsh/.zinit-list-plugins - |-- zinit-autoload.zsh/.zinit-list-snippets |-- zinit-autoload.zsh/.zinit-module - |-- zinit-autoload.zsh/.zinit-recently - |-- zinit-autoload.zsh/.zinit-search-completions - |-- zinit-autoload.zsh/.zinit-self-update - |-- zinit-autoload.zsh/.zinit-show-all-reports - |-- zinit-autoload.zsh/.zinit-show-completions - |-- zinit-autoload.zsh/.zinit-show-report - |-- zinit-autoload.zsh/.zinit-show-times - |-- zinit-autoload.zsh/.zinit-show-zstatus - |-- zinit-autoload.zsh/.zinit-uncompile-plugin |-- zinit-autoload.zsh/.zinit-uninstall-completions - |-- zinit-autoload.zsh/.zinit-unload |-- zinit-autoload.zsh/.zinit-update-or-status |-- zinit-autoload.zsh/.zinit-update-or-status-all |-- zinit-autoload.zsh/zi::version @@ -1776,6 +1744,8 @@ Has 1 line(s). Calls functions: |-- .zinit-get-object-path |   `-- .zinit-any-to-user-plugin |-- .zinit-ice + |   `-- +zi-log + |   `-- +zinit-message |-- .zinit-load-ices |   `-- .zinit-get-object-path |   `-- .zinit-any-to-user-plugin @@ -1847,22 +1817,8 @@ Has 1 line(s). Calls functions: |-- zinit-autoload.zsh/.zinit-compiled |-- zinit-autoload.zsh/.zinit-delete |-- zinit-autoload.zsh/.zinit-help - |-- zinit-autoload.zsh/.zinit-list-bindkeys - |-- zinit-autoload.zsh/.zinit-list-compdef-replay - |-- zinit-autoload.zsh/.zinit-list-plugins - |-- zinit-autoload.zsh/.zinit-list-snippets |-- zinit-autoload.zsh/.zinit-module - |-- zinit-autoload.zsh/.zinit-recently - |-- zinit-autoload.zsh/.zinit-search-completions - |-- zinit-autoload.zsh/.zinit-self-update - |-- zinit-autoload.zsh/.zinit-show-all-reports - |-- zinit-autoload.zsh/.zinit-show-completions - |-- zinit-autoload.zsh/.zinit-show-report - |-- zinit-autoload.zsh/.zinit-show-times - |-- zinit-autoload.zsh/.zinit-show-zstatus - |-- zinit-autoload.zsh/.zinit-uncompile-plugin |-- zinit-autoload.zsh/.zinit-uninstall-completions - |-- zinit-autoload.zsh/.zinit-unload |-- zinit-autoload.zsh/.zinit-update-or-status |-- zinit-autoload.zsh/.zinit-update-or-status-all |-- zinit-autoload.zsh/zi::version diff --git a/tests/commands.zunit b/tests/commands.zunit index 41041e55c..2d8570854 100644 --- a/tests/commands.zunit +++ b/tests/commands.zunit @@ -15,6 +15,19 @@ assert $output contains 'zinit delete [options] [plugins...]' assert $state equals 0 } +@test 'zinit help' { + for cmd in '-h' '--help' 'help'; do + run zinit $cmd + assert $output contains 'Usage: zinit [OPTIONS] COMMAND' + assert $state equals 0 + done +} +@test 'ice --help' { + run zinit ice --help + assert $output contains 'Usage: zinit ice [-h|--help] [args ...]' + assert $output contains 'Available ice-modifiers:' + assert $state equals 0 +} @test 'delete --all' { run zinit as'completion' is-snippet for @'https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker' assert $state equals 0 diff --git a/zinit-autoload.zsh b/zinit-autoload.zsh index c78fb59fc..502f344aa 100644 --- a/zinit-autoload.zsh +++ b/zinit-autoload.zsh @@ -1413,70 +1413,74 @@ EOF # # User-action entry point. .zinit-help() { - builtin print -r -- "${ZINIT[col-p]}Usage${ZINIT[col-rst]}: -—— help – usage information -—— bindkeys – lists bindkeys set up by each plugin -—— cd ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – cd into plugin's directory; also support snippets, if feed with URL -—— cdclear [-q] – clear compdef replay list, -q – quiet -—— cdisable ${ZINIT[col-info]}cname${ZINIT[col-rst]} – disable completion \`cname' -—— cdlist – show compdef replay list -—— cdreplay [-q] – replay compdefs (to be done after compinit), -q – quiet -—— cenable ${ZINIT[col-info]}cname${ZINIT[col-rst]} – enable completion \`cname' -—— changes ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – view plugin's git log -—— clist|completions – list completions in use -—— compile ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – compile plugin (or all plugins if ——all passed) -—— compiled – list plugins that are compiled -—— compinit – refresh installed completions -—— create ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – create plugin (also together with Github repository) -—— creinstall ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – install completions for plugin, can also receive absolute local path; -q – quiet -—— csearch – search for available completions from any plugin -—— cuninstall ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – uninstall completions for plugin -—— debug – manage debug mode -—— delete – delete a plugin or snippet -—— edit ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – edit plugin's file with \$EDITOR -—— env-whitelist [-v|-h] {env..} – allows to specify names (also patterns) of variables left unchanged during an unload. -v – verbose -—— glance ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – look at plugin's source (pygmentize, {,source-}highlight) -—— ice – add ICE to next command, argument is e.g. from\"gitlab\" -—— light [-b] ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – light plugin load, without reporting/tracking (-b – do track but bindkey-calls only) -—— load ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – load plugin, can also receive absolute local path -—— loaded|list {keyword} – show what plugins are loaded (filter with \'keyword') -—— ls – list snippets in formatted and colorized manner -—— man – manual -—— module – manage binary Zsh module shipped with Zinit, see \`zinit module help' -—— recall ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]}|URL – fetch saved ice modifiers and construct \`zinit ice ...' command -—— recently ${ZINIT[col-info]}[time-spec]${ZINIT[col-rst]} – show plugins that changed recently, argument is e.g. 1 month 2 days -—— report ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – show plugin's report (or all plugins' if ——all passed) -—— self-update – updates and compiles Zinit -—— snippet [-f] ${ZINIT[col-pname]}{url}${ZINIT[col-rst]} – source local or remote file (by direct URL), -f: force – don't use cache -—— srv {service-id} [cmd] – control a service, command can be: stop,start,restart,next,quit; \`next' moves the service to another Zshell -—— status ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]}|URL – Git status for plugin or svn status for snippet (or for all those if ——all passed) -—— stress ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – test plugin for compatibility with set of options -—— times [-s] [-m] [-a] – statistics on plugin load times, sorted in order of loading; -s – use seconds instead of milliseconds, -m – show plugin loading moments, -a – show both load times and loading moments -—— uncompile ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – remove compiled version of plugin (or of all plugins if ——all passed) -—— unload ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – unload plugin loaded with \`zinit load ...', -q – quiet -—— update [-q] ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]}|URL – Git update plugin or snippet (or all plugins and snippets if ——all passed); besides -q accepts also ——quiet, and also -r/--reset – this option causes to run git reset --hard / svn revert before pulling changes -—— version – display zinit version -—— zstatus – overall Zinit statu -—— add-fpath|fpath ${ZINIT[col-info]}[-f|--front]${ZINIT[col-rst]} \\ - ${ZINIT[col-pname]}plg-spec ${ZINIT[col-info]}[subdirectory]${ZINIT[col-rst]} – adds given plugin directory to \$fpath; if the second argument is given, it is appended to the directory path; if the option -f/--front is given, the directory path is prepended instead of appended to \$fpath. The ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} can be absolute path -—— run [-l] [plugin] {command} – runs the given command in the given plugin's directory; if the option -l will be given then the plugin should be skipped – the option will cause the previous plugin to be reused" - - integer idx - local type key - local -a arr - for type in subcommand hook; do - for (( idx=1; idx <= ZINIT_EXTS[seqno]; ++ idx )); do - key="${(k)ZINIT_EXTS[(r)$idx *]}" - [[ -z "$key" || "$key" != "z-annex $type:"* ]] && continue - arr=( "${(Q)${(z@)ZINIT_EXTS[$key]}[@]}" ) - (( ${+functions[${arr[6]}]} )) && { "${arr[6]}"; ((1)); } || \ - { builtin print -rl -- "(Couldn't find the help-handler \`${arr[6]}' of the z-annex \`${arr[3]}')"; } - done + cat <-/}:#(.*|dynamic-unscope)} ) -print -- "\nAvailable ice-modifiers:\n\n${ice_order[*]}" +For more help on how to use Ziniit, head to https://github.com/zdharma_continuum/zinit'. +EOF } # ]]] # FUNCTION: .zinit-list-bindkeys [[[ diff --git a/zinit-install.zsh b/zinit-install.zsh index cde4ff7c5..14a5bb4b2 100644 --- a/zinit-install.zsh +++ b/zinit-install.zsh @@ -12,12 +12,7 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || { # that's not the case .zinit-jq-check() { command -v jq >/dev/null && return 0 - - +zinit-message "{error}❌ ERROR: jq binary not found" \ - "{nl}{u-warn}Please install jq:{rst}" \ - "https://github.com/jqlang/jq" \ - "{nl}{u-warn}To do so with zinit, please refer to:{rst}" \ - "https://github.com/zdharma-continuum/zinit/wiki/%F0%9F%A7%8A-Recommended-ices#jq" + +zi-log '{e} Missing required dependency {cmd}jq{rst}. Please install it.' return 1 } # ]]] # FUNCTION: .zinit-json-get-value [[[ diff --git a/zinit.zsh b/zinit.zsh index 267381dde..81961bd23 100644 --- a/zinit.zsh +++ b/zinit.zsh @@ -111,7 +111,6 @@ sh|silent|\ trackbinds|\ verbose" ZINIT[cmds]="\ --help|-h|\ add-fpath|\ bindkeys|\ cclear|cd|cdclear|cdisable|cdlist|cdreplay|cenable|changes|clist|compile|compiled|compinit|completions|create|creinstall|csearch|cuninstall|\ @@ -119,7 +118,7 @@ delete|debug|\ edit|env-whitelist|\ fpath|\ glance|\ -help|\ +-h|--help|help|\ ice|\ light|load|\ man|module|\ @@ -2253,18 +2252,37 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→} # The ice-spec is valid for next command only (i.e. it "melts"), but # it can then stick to plugin and activate e.g. at update. .zinit-ice() { - builtin setopt localoptions noksharrays extendedglob warncreateglobal typesetsilent noshortloops + builtin emulate -L zsh + builtin setopt extendedglob noksharrays noshortloops typesetsilent warncreateglobal + builtin zmodload zsh/zutil 2>/dev/null || return 1 + + local opt_help + local -a cli_usage=('Usage: zinit ice [-h|--help] [args ...]') + zparseopts -D -F -K -- {h,-help}=opt_help || return 1 + if [[ -n "$opt_help" ]]; then + builtin print -l -- $cli_usage + local -a ice_order + ice_order=( ${${(s.|.)ZINIT[ice-list]}:#teleid} ${(@)${(@)${(@Akons:|:u)${ZINIT_EXTS[ice-mods]//\'\'/}}/(#s)<->-/}:#(.*|dynamic-unscope)} ) + +zi-log "{nl}Available ice-modifiers:" + builtin print -a -C 4 -x 2 -- ${ice_order[*]} + return 0 + fi + integer retval local bit exts="${(j:|:)${(@)${(@Akons:|:)${ZINIT_EXTS[ice-mods]//\'\'/}}/(#s)<->-/}}" for bit; do - [[ $bit = (#b)(--|)(${~ZINIT[ice-list]}${~exts})(*) ]] && \ - ZINIT_ICES[${match[2]}]+="${ZINIT_ICES[${match[2]}]:+;}${match[3]#(:|=)}" || \ - break + if [[ $bit = (#b)(--|)(${~ZINIT[ice-list]}${~exts})(*) ]]; then + ZINIT_ICES[${match[2]}]+="${ZINIT_ICES[${match[2]}]:+;}${match[3]#(:|=)}" + else + break + fi retval+=1 done + [[ ${ZINIT_ICES[as]} = program ]] && ZINIT_ICES[as]=command [[ -n ${ZINIT_ICES[on-update-of]} ]] && ZINIT_ICES[subscribe]="${ZINIT_ICES[subscribe]:-${ZINIT_ICES[on-update-of]}}" [[ -n ${ZINIT_ICES[pick]} ]] && ZINIT_ICES[pick]="${ZINIT_ICES[pick]//\$ZPFX/${ZPFX%/}}" + return retval } # ]]] # FUNCTION: .zinit-pack-ice [[[ @@ -2536,248 +2554,159 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→} # FUNCTION: zinit [[[ # Entrypoint function directly exposed to user, consumes subcommands with respective arguments, # and completion. -zinit() { +# +zinit () { local -A ICE ZINIT_ICE - ICE=( "${(kv)ZINIT_ICES[@]}" ) - ZINIT_ICE=( "${(kv)ICE[@]}" ) + ICE=("${(kv)ZINIT_ICES[@]}") + ZINIT_ICE=("${(kv)ICE[@]}") ZINIT_ICES=() - integer ___retval ___retval2 ___correct local -a match mbegin mend - local MATCH cmd ___q="\`" ___q2="'" IFS=$' \t\n\0'; integer MBEGIN MEND - - # An annexs subcommand might use the reply vars. - match=( ${ZINIT_EXTS[(I)z-annex subcommand:$1]} ) - if (( !${#match} )) { - local -a reply; local REPLY - } - + local MATCH cmd ___q="\`" ___q2="'" IFS=$' \t\n\0' + integer MBEGIN MEND + match=(${ZINIT_EXTS[(I)z-annex subcommand:$1]}) + if (( !${#match} )); then + local -a reply + local REPLY + fi [[ -o ksharrays ]] && ___correct=1 - local -A ___opt_map OPTS - ___opt_map=( - -q opt_-q,--quiet:"update:[Turn off almost-all messages from the {cmd}update{rst} operation {b-lhi}FOR the objects{rst} which don't have any {b-lhi}new version{rst} available.] *:[Turn off any (or: almost-any) messages from the operation.]" - --quiet opt_-q,--quiet - -v opt_-v,--verbose:"Turn on more messages from the operation." - --verbose opt_-v,--verbose - -r opt_-r,--reset:"Reset the repository before updating (or remove the files for single-file snippets and gh-r plugins)." - --reset opt_-r,--reset - -a opt_-a,--all:"delete:[Delete {hi}all{rst} plugins and snippets.] update:[Update {b-lhi}all{rst} plugins and snippets.]" - --all opt_-a,--all - -c opt_-c,--clean:"Delete {b-lhi}only{rst} the {b-lhi}currently-not loaded{rst} plugins and snippets." - --clean opt_-c,--clean - -y opt_-y,--yes:"Automatically confirm any yes/no prompts." - --yes opt_-y,--yes - -f opt_-f,--force:"Force new download of the snippet file." - --force opt_-f,--force - -p opt_-p,--parallel:"Turn on concurrent, multi-thread update (of all objects)." - --parallel opt_-p,--parallel - -s opt_-s,--snippets:"snippets:[Update only snippets (i.e.: skip updating plugins).] times:[Show times in seconds instead of milliseconds.]" - --snippets opt_-s,--snippets - -L opt_-l,--plugins:"Update only plugins (i.e.: skip updating snippets)." - --plugins opt_-l,--plugins - -h opt_-h,--help:"Show this help message." - --help opt_-h,--help - -u opt_-u,--urge:"Cause all the hooks like{ehi}:{rst} {ice}atpull{apo}''{rst}, {ice}cp{apo}''{rst}, etc. to execute even when there aren't any new commits {b}/{rst} any new version of the {b}{meta}gh-r{rst} file {b}/{rst} etc.{…} available for download {ehi}{lr}{rst} simulate a non-empty update." - --urge opt_-u,--urge - -n opt_-n,--no-pager:"Disable the use of the pager." - --no-pager opt_-n,--no-pager - -m opt_-m,--moments:"Show the {apo}*{b-lhi}moments{apo}*{rst} of object (i.e.: a plugin or snippet) loading time." - --moments opt_-m,--moments - -b opt_-b,--bindkeys:"Load in light mode, however do still track {cmd}bindkey{rst} calls (to allow remapping the keys bound)." - --bindkeys opt_-b,--bindkeys - -x opt_-x,--command:"Load the snippet as a {cmd}command{rst}, i.e.: add it to {var}\$PATH{rst} and set {b-lhi}+x{rst} on it." - --command opt_-x,--command - cdclear "--help|--quiet|-h|-q" - cdreplay "--help|--quiet|-h|-q" - delete "--all|--clean|--help|--quiet|--yes|-a|-c|-h|-q|-y" - env-whitelist "--help|--verbose|-h|-v" - light "--help|-b|-h" - snippet "--command|--force|--help|-f|-h|-x" - times "--help|-h|-m|-s" - unload "--help|--quiet|-h|-q" - update "--all|--help|--no-pager|--parallel|--plugins|--quiet|--reset|--snippets|--urge|--verbose|-L|-a|-h|-n|-p|-q|-r|-s|-u|-v" - version "" - ) - + ___opt_map=(-q opt_-q,--quiet:"update:[Turn off almost-all messages from the {cmd}update{rst} operation {b-lhi}FOR the objects{rst} which don't have any {b-lhi}new version{rst} available.] *:[Turn off any (or: almost-any) messages from the operation.]" --quiet opt_-q,--quiet -v opt_-v,--verbose:"Turn on more messages from the operation." --verbose opt_-v,--verbose -r opt_-r,--reset:"Reset the repository before updating (or remove the files for single-file snippets and gh-r plugins)." --reset opt_-r,--reset -a opt_-a,--all:"delete:[Delete {hi}all{rst} plugins and snippets.] update:[Update {b-lhi}all{rst} plugins and snippets.]" --all opt_-a,--all -c opt_-c,--clean:"Delete {b-lhi}only{rst} the {b-lhi}currently-not loaded{rst} plugins and snippets." --clean opt_-c,--clean -y opt_-y,--yes:"Automatically confirm any yes/no prompts." --yes opt_-y,--yes -f opt_-f,--force:"Force new download of the snippet file." --force opt_-f,--force -p opt_-p,--parallel:"Turn on concurrent, multi-thread update (of all objects)." --parallel opt_-p,--parallel -s opt_-s,--snippets:"snippets:[Update only snippets (i.e.: skip updating plugins).] times:[Show times in seconds instead of milliseconds.]" --snippets opt_-s,--snippets -L opt_-l,--plugins:"Update only plugins (i.e.: skip updating snippets)." --plugins opt_-l,--plugins -h opt_-h,--help:"Show this help message." --help opt_-h,--help -u opt_-u,--urge:"Cause all the hooks like{ehi}:{rst} {ice}atpull{apo}''{rst}, {ice}cp{apo}''{rst}, etc. to execute even when there aren't any new commits {b}/{rst} any new version of the {b}{meta}gh-r{rst} file {b}/{rst} etc.{…} available for download {ehi}{lr}{rst} simulate a non-empty update." --urge opt_-u,--urge -n opt_-n,--no-pager:"Disable the use of the pager." --no-pager opt_-n,--no-pager -m opt_-m,--moments:"Show the {apo}*{b-lhi}moments{apo}*{rst} of object (i.e.: a plugin or snippet) loading time." --moments opt_-m,--moments -b opt_-b,--bindkeys:"Load in light mode, however do still track {cmd}bindkey{rst} calls (to allow remapping the keys bound)." --bindkeys opt_-b,--bindkeys -x opt_-x,--command:"Load the snippet as a {cmd}command{rst}, i.e.: add it to {var}\$PATH{rst} and set {b-lhi}+x{rst} on it." --command opt_-x,--command cdclear "--help|--quiet|-h|-q" cdreplay "--help|--quiet|-h|-q" delete "--all|--clean|--help|--quiet|--yes|-a|-c|-h|-q|-y" env-whitelist "--help|--verbose|-h|-v" light "--help|-b|-h" snippet "--command|--force|--help|-f|-h|-x" times "--help|-h|-m|-s" unload "--help|--quiet|-h|-q" update "--all|--help|--no-pager|--parallel|--plugins|--quiet|--reset|--snippets|--urge|--verbose|-L|-a|-h|-n|-p|-q|-r|-s|-u|-v" version "") cmd="$1" - if [[ $cmd == (times|unload|env-whitelist|update|snippet|load|light|cdreplay|\ -cdclear) ]]; then + if [[ $cmd == (times|unload|env-whitelist|update|snippet|load|light|cdreplay|cdclear) ]]; then if (( $@[(I)-*] || OPTS[opt_-h,--help] )); then .zinit-parse-opts "$cmd" "$@" if (( OPTS[opt_-h,--help] )); then +zinit-prehelp-usage-message $cmd $___opt_map[$cmd] $@ - return 1; + return 1 fi fi fi - - reply=( ${ZINIT_EXTS[(I)z-annex subcommand:*]} ) - - [[ -n $1 && $1 != (${~ZINIT[cmds]}|${(~j:|:)reply[@]#z-annex subcommand:}) || $1 = (load|light|snippet) ]] && \ - { + reply=(${ZINIT_EXTS[(I)z-annex subcommand:*]}) + [[ ( -n $1 && $1 != (${~ZINIT[cmds]}|${(~j:|:)reply[@]#z-annex subcommand:}) ) || $1 = (load|light|snippet) ]] && { integer ___error - if [[ $1 = (load|light|snippet) ]] { - integer ___is_snippet - # Classic syntax -> simulate a call through the for-syntax. + if [[ $1 = (load|light|snippet) ]]; then + integer ___is_snippet () { builtin setopt localoptions extendedglob : ${@[@]//(#b)([ $'\t']##|(#s))(-b|--command|-f|--force)([ $'\t']##|(#e))/${OPTS[${match[2]}]::=1}} } "$@" builtin set -- "${@[@]:#(-b|--command|-f|--force)}" [[ $1 = light && -z ${OPTS[(I)-b]} ]] && ICE[light-mode]= - [[ $1 = snippet ]] && ICE[is-snippet]= || ___is_snippet=-1 + [[ $1 = snippet ]] && ICE[is-snippet]= || ___is_snippet=-1 shift - - ZINIT_ICES=( "${(kv)ICE[@]}" ) + ZINIT_ICES=("${(kv)ICE[@]}") ICE=() ZINIT_ICE=() 1="${1:+@}${1#@}${2:+/$2}" - (( $# > 1 )) && { shift -p $(( $# - 1 )); } + (( $# > 1 )) && { + shift -p $(( $# - 1 )) + } [[ -z $1 ]] && { - +zinit-message "Argument needed, try: {cmd}help." - return 1 + +zinit-message "Argument needed, try: {cmd}help." + return 1 } - } else { + else .zinit-ice "$@" ___retval2=$? local ___last_ice=${@[___retval2]} shift ___retval2 - if [[ $# -gt 0 && $1 != for ]] { - +zinit-message -n "{b}{u-warn}ERROR{b-warn}:{rst} Unknown subcommand{ehi}:" \ - "{apo}\`{cmd}$1{apo}\`{rst} " + if [[ $# -gt 0 && $1 != for ]]; then + +zinit-message -n "{b}{u-warn}ERROR{b-warn}:{rst} Unknown subcommand{ehi}:" "{apo}\`{cmd}$1{apo}\`{rst} " +zinit-prehelp-usage-message rst return 1 - } elif (( $# == 0 )) { + elif (( $# == 0 )); then ___error=1 - } else { + else shift - } - } + fi + fi integer ___had_wait local ___id ___ehid ___etid ___key local -a ___arr ZINIT[annex-exposed-processed-IDs]= - if (( $# )) { + if (( $# )); then local -a ___ices - ___ices=( "${(kv)ZINIT_ICES[@]}" ) + ___ices=("${(kv)ZINIT_ICES[@]}") ZINIT_ICES=() - while (( $# )) { + while (( $# )); do .zinit-ice "$@" ___retval2=$? local ___last_ice=${@[___retval2]} shift ___retval2 - if [[ -n $1 ]] { - ICE=( "${___ices[@]}" "${(kv)ZINIT_ICES[@]}" ) - ZINIT_ICE=( "${(kv)ICE[@]}" ) ZINIT_ICES=() + if [[ -n $1 ]]; then + ICE=("${___ices[@]}" "${(kv)ZINIT_ICES[@]}") + ZINIT_ICE=("${(kv)ICE[@]}") ZINIT_ICES=() integer ___msgs=${+ICE[debug]} (( ___msgs )) && +zinit-message "{pre}zinit-main:{faint} Processing {pname}$1{faint}{…}{rst}" - - # Delete up to the final space to get the previously-processed ID. ZINIT[annex-exposed-processed-IDs]+="${___id:+ $___id}" - - # Strip the ID-qualifier (`@') and GitHub domain from the ID. ___id="${${1#@}%%(///|//|/)}" (( ___is_snippet == -1 )) && ___id="${___id#https://github.com/}" - - # Effective handle-ID – the label under which the object - # will be identified / referred-to by Zinit. ___ehid="${ICE[id-as]:-$___id}" - - # Effective remote-ID (i.e.: URL, GitHub username/repo, - # package name, etc.). teleid'' allows "overriding" of $1. - # In case of a package using teleid'', the value here - # is being took from the given ices, before disk-ices. ___etid="${ICE[teleid]:-$___id}" - if (( ${+ICE[pack]} )); then ___had_wait=${+ICE[wait]} .zinit-load-ices "$___ehid" - # wait'' isn't possible via the disk-ices (for - # packages), only via the command's ice-spec. [[ $___had_wait -eq 0 ]] && unset 'ICE[wait]' fi - [[ ${ICE[id-as]} = (auto|) && ${+ICE[id-as]} == 1 ]] && ICE[id-as]="${___etid:t}" - - integer ___is_snippet=${${(M)___is_snippet:#-1}:-0} + integer ___is_snippet=${${(M)___is_snippet:#-1}:-0} () { builtin setopt localoptions extendedglob - if [[ $___is_snippet -ge 0 && ( -n ${ICE[is-snippet]+1} || $___etid = ((#i)(http(s|)|ftp(s|)):/|(${(~kj.|.)ZINIT_1MAP}))* ) ]] { + if [[ $___is_snippet -ge 0 && ( -n ${ICE[is-snippet]+1} || $___etid = ((#i)(http(s|)|ftp(s|)):/|(${(~kj.|.)ZINIT_1MAP}))* ) ]]; then ___is_snippet=1 - } + fi } "$@" - local ___type=${${${(M)___is_snippet:#1}:+snippet}:-plugin} - reply=( - ${(on)ZINIT_EXTS2[(I)zinit hook:before-load-pre <->]} - ${(on)ZINIT_EXTS[(I)z-annex hook:before-load-<-> <->]} - ${(on)ZINIT_EXTS2[(I)zinit hook:before-load-post <->]} - ) + reply=(${(on)ZINIT_EXTS2[(I)zinit hook:before-load-pre <->]} ${(on)ZINIT_EXTS[(I)z-annex hook:before-load-<-> <->]} ${(on)ZINIT_EXTS2[(I)zinit hook:before-load-post <->]}) for ___key in "${reply[@]}"; do - ___arr=( "${(Q)${(z@)ZINIT_EXTS[$___key]:-$ZINIT_EXTS2[$___key]}[@]}" ) - "${___arr[5]}" "$___type" "$___id" "${ICE[id_as]}" \ - "${(j: :)${(q)@[2,-1]}}" "${(j: :)${(qkv)___ices[@]}}" \ - "${${___key##(zinit|z-annex) hook:}%% <->}" load + ___arr=("${(Q)${(z@)ZINIT_EXTS[$___key]:-$ZINIT_EXTS2[$___key]}[@]}") + "${___arr[5]}" "$___type" "$___id" "${ICE[id_as]}" "${(j: :)${(q)@[2,-1]}}" "${(j: :)${(qkv)___ices[@]}}" "${${___key##(zinit|z-annex) hook:}%% <->}" load ___retval2=$? - if (( ___retval2 )) { - # An error is actually only an odd return code. + if (( ___retval2 )); then ___retval+=$(( ___retval2 & 1 ? ___retval2 : 0 )) (( ___retval2 & 1 && $# )) && shift - - # Override $@? - if (( ___retval2 & 2 )) { + if (( ___retval2 & 2 )); then local -a ___args - ___args=( "${(@Q)${(@z)ZINIT[annex-before-load:new-@]}}" ) + ___args=("${(@Q)${(@z)ZINIT[annex-before-load:new-@]}}") builtin set -- "${___args[@]}" - } - - # Override $___ices? - if (( ___retval2 & 4 )) { + fi + if (( ___retval2 & 4 )); then local -a ___new_ices - ___new_ices=( "${(Q@)${(@z)ZINIT[annex-before-load:new-global-ices]}}" ) - (( 0 == ${#___new_ices} % 2 )) && \ - ___ices=( "${___new_ices[@]}" ) || \ - { [[ ${ZINIT[MUTE_WARNINGS]} != (1|true|on|yes) ]] && \ - +zinit-message "{u-warn}Warning{b-warn}:{msg} Bad new-ices returned" \ - "from the annex{ehi}:{rst} {annex}${___arr[3]}{msg}," \ - "please file an issue report at:{url}" \ - "https://github.com/zdharma-continuum/${___arr[3]}/issues/new{msg}.{rst}" - ___ices=( ) ___retval+=7 - } - } + ___new_ices=("${(Q@)${(@z)ZINIT[annex-before-load:new-global-ices]}}") + (( 0 == ${#___new_ices} % 2 )) && ___ices=("${___new_ices[@]}") || { + [[ ${ZINIT[MUTE_WARNINGS]} != (1|true|on|yes) ]] && +zinit-message "{u-warn}Warning{b-warn}:{msg} Bad new-ices returned" "from the annex{ehi}:{rst} {annex}${___arr[3]}{msg}," "please file an issue report at:{url}" "https://github.com/zdharma-continuum/${___arr[3]}/issues/new{msg}.{rst}" + ___ices=() ___retval+=7 + } + fi continue 2 - } + fi done integer ___action_load=0 ___turbo=0 - if [[ -n ${(M)${+ICE[wait]}:#1}${ICE[load]}${ICE[unload]}${ICE[service]}${ICE[subscribe]} ]] { + if [[ -n ${(M)${+ICE[wait]}:#1}${ICE[load]}${ICE[unload]}${ICE[service]}${ICE[subscribe]} ]]; then ___turbo=1 - } - - if [[ -n ${ICE[trigger-load]} || \ - ( ${+ICE[wait]} == 1 && - ${ICE[wait]} = (\!|)(<->(a|b|c|)|) ) - ]] && (( !ZINIT[OPTIMIZE_OUT_DISK_ACCESSES] - )) { - if (( ___is_snippet > 0 )) { + fi + if [[ -n ${ICE[trigger-load]} || ( ${+ICE[wait]} == 1 && ${ICE[wait]} = (\!|)(<->(a|b|c|)|) ) ]] && (( !ZINIT[OPTIMIZE_OUT_DISK_ACCESSES] )); then + if (( ___is_snippet > 0 )); then .zinit-get-object-path snippet $___ehid - } else { + else .zinit-get-object-path plugin $___ehid + fi + (( $? )) && [[ ${zsh_eval_context[1]} = file ]] && { + ___action_load=1 } - (( $? )) && [[ ${zsh_eval_context[1]} = file ]] && { ___action_load=1; } local ___object_path="$REPLY" - } elif (( ! ___turbo )) { + elif (( ! ___turbo )); then ___action_load=1 - reply=( 1 ) - } else { - reply=( 1 ) - } - - if [[ ${reply[-1]} -eq 1 && -n ${ICE[trigger-load]} ]] { + reply=(1) + else + reply=(1) + fi + if [[ ${reply[-1]} -eq 1 && -n ${ICE[trigger-load]} ]]; then () { builtin setopt localoptions extendedglob local ___mode - (( ___is_snippet > 0 )) && ___mode=snippet || ___mode="${${${ICE[light-mode]+light}}:-load}" - for MATCH ( ${(s.;.)ICE[trigger-load]} ) { + (( ___is_snippet > 0 )) && ___mode=snippet || ___mode="${${${ICE[light-mode]+light}}:-load}" + for MATCH in ${(s.;.)ICE[trigger-load]}; do eval "${MATCH#!}() { ${${(M)MATCH#!}:+unset -f ${MATCH#!}} local a b; local -a ices @@ -2789,130 +2718,130 @@ cdclear) ]]; then ${${(M)MATCH#!}:+# Forward the call eval ${MATCH#!} \$@} }" - } + done } "$@" ___retval+=$? (( $# )) && shift continue - } - - if (( ${+ICE[if]} )) { - eval "${ICE[if]}" || { (( $# )) && shift; continue; }; - } - for REPLY ( ${(s.;.)ICE[has]} ) { - (( ${+commands[$REPLY]} )) || \ - { (( $# )) && shift; continue 2; } - } - + fi + if (( ${+ICE[if]} )); then + eval "${ICE[if]}" || { + (( $# )) && shift + continue + } + fi + for REPLY in ${(s.;.)ICE[has]}; do + (( ${+commands[$REPLY]} )) || { + (( $# )) && shift + continue 2 + } + done integer ___had_cloneonly=0 ICE[wait]="${${(M)${+ICE[wait]}:#1}:+${(M)ICE[wait]#!}${${ICE[wait]#!}:-0}}" - if (( ___action_load || !ZINIT[HAVE_SCHEDULER] )) { - if (( ___turbo && ZINIT[HAVE_SCHEDULER] )) { + if (( ___action_load || !ZINIT[HAVE_SCHEDULER] )); then + if (( ___turbo && ZINIT[HAVE_SCHEDULER] )); then ___had_cloneonly=${+ICE[cloneonly]} ICE[cloneonly]="" - } - - (( ___is_snippet )) && \ - local ___opt="${(k)OPTS[*]}" || \ - local ___opt="${${ICE[light-mode]+light}:-${OPTS[(I)-b]:+light-b}}" - + fi + (( ___is_snippet )) && local ___opt="${(k)OPTS[*]}" || local ___opt="${${ICE[light-mode]+light}:-${OPTS[(I)-b]:+light-b}}" .zinit-load-object ${${${(M)___is_snippet:#1}:+snippet}:-plugin} $___id $___opt integer ___last_retval=$? ___retval+=___last_retval - - if (( ___turbo && !___had_cloneonly && ZINIT[HAVE_SCHEDULER] )) { + if (( ___turbo && !___had_cloneonly && ZINIT[HAVE_SCHEDULER] )); then command rm -f $___object_path/._zinit/cloneonly unset 'ICE[cloneonly]' - } - } - if (( ___turbo && ZINIT[HAVE_SCHEDULER] && 0 == ___last_retval )) { + fi + fi + if (( ___turbo && ZINIT[HAVE_SCHEDULER] && 0 == ___last_retval )); then ICE[wait]="${ICE[wait]:-${ICE[service]:+0}}" if (( ___is_snippet > 0 )); then ZINIT_SICE[$___ehid]= - .zinit-submit-turbo s${ICE[service]:+1} "" \ - "$___id" "${(k)OPTS[*]}" + .zinit-submit-turbo s${ICE[service]:+1} "" "$___id" "${(k)OPTS[*]}" else ZINIT_SICE[$___ehid]= - .zinit-submit-turbo p${ICE[service]:+1} \ - "${${${ICE[light-mode]+light}}:-load}" \ - "$___id" "" + .zinit-submit-turbo p${ICE[service]:+1} "${${${ICE[light-mode]+light}}:-load}" "$___id" "" fi ___retval+=$? - } - } else { + fi + else ___error=1 - } + fi (( $# )) && shift ___is_snippet=0 - } - } else { + done + else ___error=1 - } - - if (( ___error )) { + fi + if (( ___error )); then () { builtin emulate -LR zsh -o extendedglob ${=${options[xtrace]:#off}:+-o xtrace} +zinit-message -n "{u-warn}Error{b-warn}:{rst} No plugin or snippet ID given" - if [[ -n $___last_ice ]] { - +zinit-message -n " (the last recognized ice was: {ice}"\ -"${___last_ice/(#m)(${~ZINIT[ice-list]})/"{data}$MATCH"}{apo}''{rst}).{error} + if [[ -n $___last_ice ]]; then + +zinit-message -n " (the last recognized ice was: {ice}""${___last_ice/(#m)(${~ZINIT[ice-list]})/"{data}$MATCH"}{apo}''{rst}).{error} You can try to prepend {apo}${___q}{lhi}@{apo}'{error} to the ID if the last ice is in fact a plugin.{rst} {note}Note:{rst} The {apo}\`{ice}ice{apo}\`{rst} subcommand is now again required if not using the for-syntax" - } + fi +zinit-message "." } return 2 - } elif (( ! $# )) { - return ___retval - } + elif (( ! $# )); then + return ___retval + fi } - case "$1" in - (ice) - shift - .zinit-ice "$@" - ;; - (cdreplay) - .zinit-compdef-replay "$2"; ___retval=$? - ;; - (cdclear) - .zinit-compdef-clear "$2" - ;; - (add-fpath|fpath) - .zinit-add-fpath "${@[2-correct,-1]}" - ;; - (run) - .zinit-run "${@[2-correct,-1]}" - ;; - - (man) - man "${ZINIT[BIN_DIR]}/doc/zinit.1" - ;; - (env-whitelist) + (ice) + shift + .zinit-ice $@ + ;; + (cdreplay) + .zinit-compdef-replay "$2" + ___retval=$? + ;; + (cdclear) + .zinit-compdef-clear "$2" + ;; + (add-fpath|fpath) + .zinit-add-fpath "${@[2-correct,-1]}" + ;; + (run) + .zinit-run "${@[2-correct,-1]}" + ;; + (man) + man "${ZINIT[BIN_DIR]}/doc/zinit.1" + ;; + (env-whitelist) shift .zinit-parse-opts env-whitelist "$@" builtin set -- "${reply[@]}" - - if (( $# == 0 )) { + if (( $# == 0 )); then ZINIT[ENV-WHITELIST]= (( OPTS[opt_-v,--verbose] )) && +zinit-message "{msg2}Cleared the parameter whitelist.{rst}" - } else { + else ZINIT[ENV-WHITELIST]+="${(j: :)${(q-kv)@}} " local ___sep="$ZINIT[col-msg2], $ZINIT[col-data2]" (( OPTS[opt_-v,--verbose] )) && +zinit-message "{msg2}Extended the parameter whitelist with: {data2}${(pj:$___sep:)@}{msg2}.{rst}" - } + fi ;; - (*) - # Check if there is a z-annex registered for the subcommand. - reply=( ${ZINIT_EXTS[z-annex subcommand:${(q)1}]} ) - (( ${#reply} )) && { - reply=( "${(Q)${(z@)reply[1]}[@]}" ) - (( ${+functions[${reply[5]}]} )) && \ - { "${reply[5]}" "$@"; return $?; } || \ - { +zinit-message "({error}Couldn't find the subcommand-handler \`{obj}${reply[5]}{error}' of the z-annex \`{file}${reply[3]}{error}')"; return 1; } - } - (( ${+functions[.zinit-confirm]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-autoload.zsh" || return 1 - case "$1" in + (*) + reply=(${ZINIT_EXTS[z-annex subcommand:${(q)1}]}) + (( ${#reply} )) && { + reply=("${(Q)${(z@)reply[1]}[@]}") + (( ${+functions[${reply[5]}]} )) && { + "${reply[5]}" "$@" + return $? + } || { + +zinit-message "({error}Couldn't find the subcommand-handler \`{obj}${reply[5]}{error}' of the z-annex \`{file}${reply[3]}{error}')" + return 1 + } + } + (( ${+functions[.zinit-confirm]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-autoload.zsh" || return 1 + case "$1" in + (--help|-h|help) + .zinit-help + ;; + (version) + zi::version + ;; (zstatus) .zinit-show-zstatus ;; @@ -2929,51 +2858,68 @@ You can try to prepend {apo}${___q}{lhi}@{apo}'{error} to the ID if the last ice (unload) (( ${+functions[.zinit-unload]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-autoload.zsh" || return 1 if [[ -z $2 && -z $3 ]]; then - builtin print "Argument needed, try: help"; ___retval=1 + builtin print "Argument needed, try: help" + ___retval=1 else - [[ $2 = -q ]] && { 5=-q; shift; } - # Unload given plugin. Cloned directory remains intact - # so as are completions. - .zinit-unload "${2%%(///|//|/)}" "${${3:#-q}%%(///|//|/)}" "${${(M)4:#-q}:-${(M)3:#-q}}"; ___retval=$? + [[ $2 = -q ]] && { + 5=-q + shift + } + .zinit-unload "${2%%(///|//|/)}" "${${3:#-q}%%(///|//|/)}" "${${(M)4:#-q}:-${(M)3:#-q}}" + ___retval=$? fi ;; - (bindkeys) + (bindkeys) .zinit-list-bindkeys ;; - (update) - if (( ${+ICE[if]} )) { - eval "${ICE[if]}" || return 1; - } - for REPLY ( ${(s.;.)ICE[has]} ) { + (update) + if (( ${+ICE[if]} )); then + eval "${ICE[if]}" || return 1 + fi + for REPLY in ${(s.;.)ICE[has]}; do (( ${+commands[$REPLY]} )) || return 1 - } + done shift .zinit-parse-opts update "$@" builtin set -- "${reply[@]}" if [[ ${OPTS[opt_-a,--all]} -eq 1 || ${OPTS[opt_-p,--parallel]} -eq 1 || ${OPTS[opt_-s,--snippets]} -eq 1 || ${OPTS[opt_-l,--plugins]} -eq 1 || -z $1$2${ICE[teleid]}${ICE[id-as]} ]]; then - [[ -z $1$2 && $(( OPTS[opt_-a,--all] + OPTS[opt_-p,--parallel] + OPTS[opt_-s,--snippets] + OPTS[opt_-l,--plugins] )) -eq 0 ]] && { builtin print -r -- "Assuming --all is passed"; sleep 3; } + [[ -z $1$2 && $(( OPTS[opt_-a,--all] + OPTS[opt_-p,--parallel] + OPTS[opt_-s,--snippets] + OPTS[opt_-l,--plugins] )) -eq 0 ]] && { + builtin print -r -- "Assuming --all is passed" + sleep 3 + } (( OPTS[opt_-p,--parallel] )) && OPTS[value]=${1:-15} - .zinit-update-or-status-all update; ___retval=$? + .zinit-update-or-status-all update + ___retval=$? else local ___key ___id="${1%%(///|//|/)}${2:+/}${2%%(///|//|/)}" [[ -z ${___id//[[:space:]]/} ]] && ___id="${ICE[id-as]:-$ICE[teleid]}" - .zinit-update-or-status update "$___id" ""; ___retval=$? + .zinit-update-or-status update "$___id" "" + ___retval=$? fi ;; (status) if [[ $2 = --all || ( -z $2 && -z $3 ) ]]; then - [[ -z $2 ]] && { builtin print -r -- "Assuming --all is passed"; sleep 3; } - .zinit-update-or-status-all status; ___retval=$? + [[ -z $2 ]] && { + builtin print -r -- "Assuming --all is passed" + sleep 3 + } + .zinit-update-or-status-all status + ___retval=$? else - .zinit-update-or-status status "${2%%(///|//|/)}" "${3%%(///|//|/)}"; ___retval=$? + .zinit-update-or-status status "${2%%(///|//|/)}" "${3%%(///|//|/)}" + ___retval=$? fi ;; (report) if [[ $2 = --all || ( -z $2 && -z $3 ) ]]; then - [[ -z $2 ]] && { builtin print -r -- "Assuming --all is passed"; sleep 4; } + [[ -z $2 ]] && { + builtin print -r -- "Assuming --all is passed" + sleep 4 + } .zinit-show-all-reports else - .zinit-show-report "${2%%(///|//|/)}" "${3%%(///|//|/)}"; ___retval=$? + .zinit-show-report "${2%%(///|//|/)}" "${3%%(///|//|/)}" + ___retval=$? fi ;; (plugins) @@ -2982,19 +2928,18 @@ You can try to prepend {apo}${___q}{lhi}@{apo}'{error} to the ID if the last ice (snippets) .zinit-list-snippets "$2" ;; - (completions) # Show installed, enabled or disabled, completions and detect stray and improper ones + (completions) .zinit-show-completions "$2" ;; - (cclear) # Delete stray and improper completions. + (cclear) .zinit-clear-completions ;; (cdisable) if [[ -z $2 ]]; then - builtin print "Argument needed, try: help"; ___retval=1 + builtin print "Argument needed, try: help" + ___retval=1 else local ___f="_${2#_}" - # Disable completion given by completion function name - # with or without leading _, e.g. cp, _cp. if .zinit-cdisable "$___f"; then (( ${+functions[.zinit-forget-completion]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-install.zsh" || return 1 .zinit-forget-completion "$___f" @@ -3008,11 +2953,10 @@ You can try to prepend {apo}${___q}{lhi}@{apo}'{error} to the ID if the last ice ;; (cenable) if [[ -z $2 ]]; then - builtin print "Argument needed, try: help"; ___retval=1 + builtin print "Argument needed, try: help" + ___retval=1 else - local ___f="_${2#_}" - # Enable completion given by completion function name - # with or without leading _, e.g. cp, _cp. + local ___f="_${2#_}" if .zinit-cenable "$___f"; then (( ${+functions[.zinit-forget-completion]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-install.zsh" || return 1 .zinit-forget-completion "$___f" @@ -3026,20 +2970,24 @@ You can try to prepend {apo}${___q}{lhi}@{apo}'{error} to the ID if the last ice ;; (creinstall) (( ${+functions[.zinit-install-completions]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-install.zsh" || return 1 - # Installs completions for plugin. Enables them all. It is a reinstallation, thus every obstacle gets overwritten or removed. - [[ $2 = -[qQ] ]] && { 5=$2; shift; } - .zinit-install-completions "${2%%(///|//|/)}" "${3%%(///|//|/)}" 1 "${(M)4:#-[qQ]}"; ___retval=$? + [[ $2 = -[qQ] ]] && { + 5=$2 + shift + } + .zinit-install-completions "${2%%(///|//|/)}" "${3%%(///|//|/)}" 1 "${(M)4:#-[qQ]}" + ___retval=$? [[ -z ${(M)4:#-[qQ]} ]] && +zinit-message "Initializing completion ({func}compinit{rst}){…}" builtin autoload -Uz compinit compinit -d ${ZINIT[ZCOMPDUMP_PATH]:-${ZDOTDIR:-$HOME}/.zcompdump} "${(Q@)${(z@)ZINIT[COMPINIT_OPTS]}}" ;; (cuninstall) if [[ -z $2 && -z $3 ]]; then - builtin print "Argument needed, try: help"; ___retval=1 + builtin print "Argument needed, try: help" + ___retval=1 else (( ${+functions[.zinit-forget-completion]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-install.zsh" || return 1 - # Uninstalls completions for plugin. - .zinit-uninstall-completions "${2%%(///|//|/)}" "${3%%(///|//|/)}"; ___retval=$? + .zinit-uninstall-completions "${2%%(///|//|/)}" "${3%%(///|//|/)}" + ___retval=$? +zinit-message "Initializing completion ({func}compinit{rst}){…}" builtin autoload -Uz compinit compinit -d ${ZINIT[ZCOMPDUMP_PATH]:-${ZDOTDIR:-$HOME}/.zcompdump} "${(Q@)${(z@)ZINIT[COMPINIT_OPTS]}}" @@ -3050,28 +2998,38 @@ You can try to prepend {apo}${___q}{lhi}@{apo}'{error} to the ID if the last ice ;; (compinit) (( ${+functions[.zinit-forget-completion]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-install.zsh" || return 1 - .zinit-compinit; ___retval=$? + .zinit-compinit + ___retval=$? ;; (compile) (( ${+functions[.zinit-compile-plugin]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-install.zsh" || return 1 if [[ $2 = --all || ( -z $2 && -z $3 ) ]]; then - [[ -z $2 ]] && { builtin print -r -- "Assuming --all is passed"; sleep 3; } - .zinit-compile-uncompile-all 1; ___retval=$? + [[ -z $2 ]] && { + builtin print -r -- "Assuming --all is passed" + sleep 3 + } + .zinit-compile-uncompile-all 1 + ___retval=$? else - .zinit-compile-plugin "${2%%(///|//|/)}" "${3%%(///|//|/)}"; ___retval=$? + .zinit-compile-plugin "${2%%(///|//|/)}" "${3%%(///|//|/)}" + ___retval=$? fi ;; - (debug) - shift; + (debug) shift (( ${+functions[+zinit-debug]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-additional.zsh" +zinit-debug $@ ;; (uncompile) if [[ $2 = --all || ( -z $2 && -z $3 ) ]]; then - [[ -z $2 ]] && { builtin print -r -- "Assuming --all is passed"; sleep 3; } - .zinit-compile-uncompile-all 0; ___retval=$? + [[ -z $2 ]] && { + builtin print -r -- "Assuming --all is passed" + sleep 3 + } + .zinit-compile-uncompile-all 0 + ___retval=$? else - .zinit-uncompile-plugin "${2%%(///|//|/)}" "${3%%(///|//|/)}"; ___retval=$? + .zinit-uncompile-plugin "${2%%(///|//|/)}" "${3%%(///|//|/)}" + ___retval=$? fi ;; (compiled) @@ -3081,47 +3039,49 @@ You can try to prepend {apo}${___q}{lhi}@{apo}'{error} to the ID if the last ice .zinit-list-compdef-replay ;; (cd|recall|edit|glance|changes|create|stress) - .zinit-"$1" "${@[2-correct,-1]%%(///|//|/)}"; ___retval=$? + .zinit-"$1" "${@[2-correct,-1]%%(///|//|/)}" + ___retval=$? ;; (recently) shift - .zinit-recently "$@"; ___retval=$? - ;; - (-h|--help|help) - .zinit-help - ;; - (version) - zi::version + .zinit-recently "$@" + ___retval=$? ;; (srv) - () { setopt localoptions extendedglob warncreateglobal - [[ ! -e ${ZINIT[SERVICES_DIR]}/"$2".fifo ]] && { builtin print "No such service: $2"; } || - { [[ $3 = (#i)(next|stop|quit|restart) ]] && - { builtin print "${(U)3}" >>! ${ZINIT[SERVICES_DIR]}/"$2".fifo || builtin print "Service $2 inactive"; ___retval=1; } || - { [[ $3 = (#i)start ]] && rm -f ${ZINIT[SERVICES_DIR]}/"$2".stop || - { builtin print "Unknown service-command: $3"; ___retval=1; } + () { + setopt localoptions extendedglob warncreateglobal + [[ ! -e ${ZINIT[SERVICES_DIR]}/"$2".fifo ]] && { + builtin print "No such service: $2" + } || { + [[ $3 = (#i)(next|stop|quit|restart) ]] && { + builtin print "${(U)3}" >>| ${ZINIT[SERVICES_DIR]}/"$2".fifo || builtin print "Service $2 inactive" + ___retval=1 + } || { + [[ $3 = (#i)start ]] && rm -f ${ZINIT[SERVICES_DIR]}/"$2".stop || { + builtin print "Unknown service-command: $3" + ___retval=1 } + } } } "$@" ;; (module) - .zinit-module "${@[2-correct,-1]}"; ___retval=$? + .zinit-module "${@[2-correct,-1]}" + ___retval=$? ;; - (*) - if [[ -z $1 ]] { - +zinit-message -n "{b}{u-warn}ERROR{b-warn}:{rst} Missing a {cmd}subcommand " - +zinit-prehelp-usage-message rst - } else { - +zinit-message -n "{b}{u-warn}ERROR{b-warn}:{rst} Unknown subcommand{ehi}:{rst}" \ - "{apo}\`{error}$1{apo}\`{rst} " - +zinit-prehelp-usage-message rst - } + (*) + if [[ -z $1 ]]; then + +zinit-message -n "{b}{u-warn}ERROR{b-warn}:{rst} Missing a {cmd}subcommand " + +zinit-prehelp-usage-message rst + else + +zinit-message -n "{b}{u-warn}ERROR{b-warn}:{rst} Unknown subcommand{ehi}:{rst}" "{apo}\`{error}$1{apo}\`{rst} " + +zinit-prehelp-usage-message rst + fi ___retval=1 ;; - esac - ;; + esac + ;; esac - return ___retval } # ]]] # FUNCTION: zicdreplay [[[