From 19dd11acea050b7fd37b7dd7e3bcb08d583fff28 Mon Sep 17 00:00:00 2001 From: Vladislav Doster Date: Sun, 14 May 2023 10:57:16 -0500 Subject: [PATCH] fix: creinstall cmd --quiet & --force flags Signed-off-by: Vladislav Doster --- _zinit | 21 +- doc/zsdoc/zinit-install.zsh.adoc | 43 +-- doc/zsdoc/zinit-side.zsh.adoc | 2 - doc/zsdoc/zinit.zsh.adoc | 142 +++++++- zinit-install.zsh | 117 ++++--- zinit.zsh | 579 ++++++++++++++----------------- 6 files changed, 472 insertions(+), 432 deletions(-) diff --git a/_zinit b/_zinit index 8a9a88f05..d77270e4d 100644 --- a/_zinit +++ b/_zinit @@ -194,7 +194,12 @@ _zinit_create(){ } # ]]] # FUNCTION: _zinit_creinstall [[[ _zinit_creinstall(){ - _arguments - plugin '1::plugin:__zinit_installed_plugins' && ret=0 + _arguments -A \ + {-f,--force}'[Force new download of the snippet file]' \ + {-h,--help}'[Show this help message]' \ + {-q,--quiet}'[Turn off messages from the operation]' \ + '1::plugin:__zinit_installed_plugins' \ + && ret=0 } # ]]] # FUNCTION: _zinit_csearch [[[ _zinit_csearch(){ @@ -223,14 +228,15 @@ _zinit_debug(){ _zinit_edit(){ _arguments \ - installed '*::plugin:__zinit_installed_plugins' \ - - snippet '*::snippet:__zinit_installed_snippets' && ret=0 + - snippet '*::snippet:__zinit_installed_snippets' \ + && ret=0 } # ]]] # FUNCTION: _zinit_env_whitelist [[[ _zinit_env_whitelist(){ _arguments -A \ '(-h --help)'{-h,--help}'[Show this help message]' \ '(-v --verbose)'{-v,--verbose}'[Make some output more verbose]' \ - && ret=0 + && ret=0 } # ]]] # FUNCTION: _zinit_glance [[[ _zinit_glance(){ @@ -269,7 +275,8 @@ _zinit_report(){ _zinit_run(){ _arguments \ - installed '1:installed:__zinit_installed' \ - '2:command to run:' && ret=0 + '2:command to run:' \ + && ret=0 } # ]]] # FUNCTION: _zinit_self_update [[[ _zinit_self_update(){ @@ -312,7 +319,8 @@ _zinit_unload(){ _arguments -A \ '(-h --help)'{-h,--help}'[Show this help message]' \ '(-q --quiet)'{-q,--quiet}'[Turn off messages from the operation]' \ - - installed '*:installed:__zinit_installed' + - installed '*:installed:__zinit_installed' \ + && ret=0 } # ]]] # FUNCTION: _zinit_update [[[ _zinit_update(){ @@ -326,7 +334,8 @@ _zinit_update(){ '--parallel[Turn on concurrent, multi-thread update (of all objects)]' \ '(-a --all)'{-a,--all}'[Update all plugins and snippets]' \ - set2 \ - '1:installed:__zinit_installed' + '1:installed:__zinit_installed' \ + && ret=0 } # ]]] # FUNCTION: _zunit_load [[[ _zinit_load() { diff --git a/doc/zsdoc/zinit-install.zsh.adoc b/doc/zsdoc/zinit-install.zsh.adoc index 2c97b0191..cb7ffea33 100644 --- a/doc/zsdoc/zinit-install.zsh.adoc +++ b/doc/zsdoc/zinit-install.zsh.adoc @@ -204,11 +204,8 @@ Has 377 line(s). Calls functions: |   |   |-- .zinit-forget-completion |   |   |-- compinit |   |   `-- zinit.zsh/+zinit-message - |   |-- .zinit-forget-completion - |   |-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 - |   |-- zinit-side.zsh/.zinit-exists-physically-message - |   |-- zinit.zsh/+zinit-message - |   `-- zinit.zsh/.zinit-any-to-user-plugin + |   |-- zinit.zsh/+zi-log + |   `-- zinit.zsh/+zinit-message |-- .zinit-mirror-using-svn |-- zinit-side.zsh/.zinit-store-ices |-- zinit.zsh/+zinit-message @@ -254,7 +251,6 @@ Uses feature(s): _setopt_, _unfunction_ Called by: .zinit-compinit - .zinit-install-completions zinit-autoload.zsh/.zinit-uninstall-completions zinit.zsh/zinit @@ -338,37 +334,32 @@ Called by: ____ - Installs all completions of given plugin. After that they are - visible to 'compinit'. Visible completions can be selectively - disabled and enabled. User can access completion data with - 'clist' or 'completions' subcommand. + Installs plugin completions. $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin) $2 - plugin if $1 (i.e., user) given $3 - if 1, then reinstall, otherwise only install completions that are not present + ____ -Has 62 line(s). Calls functions: +Has 76 line(s). Calls functions: .zinit-install-completions |-- .zinit-compinit |   |-- .zinit-forget-completion |   |-- compinit |   `-- zinit.zsh/+zinit-message - |-- .zinit-forget-completion - |-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 - |-- zinit-side.zsh/.zinit-exists-physically-message - |-- zinit.zsh/+zinit-message - `-- zinit.zsh/.zinit-any-to-user-plugin + |-- zinit.zsh/+zi-log + `-- zinit.zsh/+zinit-message -Uses feature(s): _setopt_ +Uses feature(s): _setopt_, _zparseopts_ Called by: .zinit-download-snippet .zinit-setup-plugin-dir - zinit.zsh/zinit + zinit.zsh/+zi-cmp-reinstall ==== .zinit-jq-check @@ -487,11 +478,8 @@ Has 214 line(s). Calls functions: |   |   |-- .zinit-forget-completion |   |   |-- compinit |   |   `-- zinit.zsh/+zinit-message - |   |-- .zinit-forget-completion - |   |-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 - |   |-- zinit-side.zsh/.zinit-exists-physically-message - |   |-- zinit.zsh/+zinit-message - |   `-- zinit.zsh/.zinit-any-to-user-plugin + |   |-- zinit.zsh/+zi-log + |   `-- zinit.zsh/+zinit-message |-- ziextract |   `-- zinit.zsh/+zinit-message |-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 @@ -534,11 +522,8 @@ Has 76 line(s). Calls functions: |   |   |   |-- .zinit-forget-completion |   |   |   |-- compinit |   |   |   `-- zinit.zsh/+zinit-message - |   |   |-- .zinit-forget-completion - |   |   |-- zinit-side.zsh/.zinit-any-colorify-as-uspl2 - |   |   |-- zinit-side.zsh/.zinit-exists-physically-message - |   |   |-- zinit.zsh/+zinit-message - |   |   `-- zinit.zsh/.zinit-any-to-user-plugin + |   |   |-- zinit.zsh/+zi-log + |   |   `-- zinit.zsh/+zinit-message |   |-- .zinit-mirror-using-svn |   |-- zinit-side.zsh/.zinit-store-ices |   |-- zinit.zsh/+zinit-message @@ -850,7 +835,7 @@ ____ ____ -Has 549 line(s). Doesn't call other functions. +Has 573 line(s). Doesn't call other functions. Uses feature(s): _autoload_, _bindkey_, _compdef_, _compdump_, _eval_, _read_, _setopt_, _unfunction_, _zle_, _zstyle_ diff --git a/doc/zsdoc/zinit-side.zsh.adoc b/doc/zsdoc/zinit-side.zsh.adoc index a9b3378c4..5ec7f0158 100644 --- a/doc/zsdoc/zinit-side.zsh.adoc +++ b/doc/zsdoc/zinit-side.zsh.adoc @@ -60,7 +60,6 @@ Called by: 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 zinit-install.zsh/.zinit-setup-plugin-dir zinit.zsh/.zinit-formatter-pid @@ -205,7 +204,6 @@ Called by: zinit-autoload.zsh/.zinit-glance zinit-autoload.zsh/.zinit-stress zinit-autoload.zsh/.zinit-update-or-status - zinit-install.zsh/.zinit-install-completions ==== .zinit-first diff --git a/doc/zsdoc/zinit.zsh.adoc b/doc/zsdoc/zinit.zsh.adoc index 7a8d8e17e..4cc08c901 100644 --- a/doc/zsdoc/zinit.zsh.adoc +++ b/doc/zsdoc/zinit.zsh.adoc @@ -6,6 +6,7 @@ zinit.zsh - a shell script Documentation automatically generated with `zshelldoc' == FUNCTIONS + +zi-cmp-reinstall +zi-log +zinit-deploy-message +zinit-message @@ -89,6 +90,7 @@ Has 244 line(s). Calls functions: Script-Body |-- +zinit-message + |   `-- +zi-log |-- .zinit-get-mtime-into |-- .zinit-prepare-home |   |-- zinit-autoload.zsh/.zinit-clear-completions @@ -98,15 +100,22 @@ Has 244 line(s). Calls functions: |-- colors |-- is-at-least |-- zinit + |   |-- +zi-cmp-reinstall + |   |   |-- compinit + |   |   `-- zinit-install.zsh/.zinit-install-completions |   |-- +zinit-message + |   |   `-- +zi-log |   |-- +zinit-prehelp-usage-message |   |   `-- +zinit-message + |   |   `-- +zi-log |   |-- .zinit-add-fpath |   |   `-- .zinit-any-to-user-plugin |   |-- .zinit-compdef-clear |   |   `-- +zinit-message + |   |   `-- +zi-log |   |-- .zinit-compdef-replay |   |   `-- +zinit-message + |   |   `-- +zi-log |   |-- .zinit-get-object-path |   |   `-- .zinit-any-to-user-plugin |   |-- .zinit-ice @@ -130,12 +139,14 @@ Has 244 line(s). Calls functions: |   |   |   |   |-- .zinit-tmp-subst-on |   |   |   |   `-- :zinit-tmp-subst-autoload |   |   |   |   |-- +zinit-message + |   |   |   |   |   `-- +zi-log |   |   |   |   |-- .zinit-add-report |   |   |   |   |-- .zinit-any-to-user-plugin |   |   |   |   `-- is-at-least |   |   |   |-- .zinit-load-snippet |   |   |   |   |-- +zinit-deploy-message |   |   |   |   |-- +zinit-message + |   |   |   |   |   `-- +zi-log |   |   |   |   |-- .zinit-add-report |   |   |   |   |-- .zinit-find-other-matches |   |   |   |   |-- .zinit-get-object-path @@ -143,19 +154,23 @@ Has 244 line(s). Calls functions: |   |   |   |   |-- .zinit-pack-ice |   |   |   |   |-- .zinit-set-m-func |   |   |   |   |   `-- +zinit-message + |   |   |   |   |   `-- +zi-log |   |   |   |   |-- .zinit-setup-params |   |   |   |   `-- zinit-install.zsh/.zinit-download-snippet |   |   |   |-- .zinit-pack-ice |   |   |   |-- .zinit-register-plugin |   |   |   |   `-- +zinit-message + |   |   |   |   `-- +zi-log |   |   |   |-- .zinit-set-m-func |   |   |   |   `-- +zinit-message + |   |   |   |   `-- +zi-log |   |   |   |-- .zinit-setup-params |   |   |   |-- zinit-install.zsh/.zinit-get-package |   |   |   `-- zinit-install.zsh/.zinit-setup-plugin-dir |   |   `-- .zinit-load-snippet |   |   |-- +zinit-deploy-message |   |   |-- +zinit-message + |   |   |   `-- +zi-log |   |   |-- .zinit-add-report |   |   |-- .zinit-find-other-matches |   |   |-- .zinit-get-object-path @@ -163,11 +178,13 @@ Has 244 line(s). Calls functions: |   |   |-- .zinit-pack-ice |   |   |-- .zinit-set-m-func |   |   |   `-- +zinit-message + |   |   |   `-- +zi-log |   |   |-- .zinit-setup-params |   |   `-- zinit-install.zsh/.zinit-download-snippet |   |-- .zinit-parse-opts |   |-- .zinit-run |   |   |-- +zinit-message + |   |   |   `-- +zi-log |   |   |-- .zinit-any-to-user-plugin |   |   `-- .zinit-get-object-path |   |   `-- .zinit-any-to-user-plugin @@ -202,15 +219,14 @@ Has 244 line(s). Calls functions: |   |-- zinit-autoload.zsh/zi::version |   |-- zinit-install.zsh/.zinit-compile-plugin |   |-- zinit-install.zsh/.zinit-compinit - |   |-- zinit-install.zsh/.zinit-forget-completion - |   `-- zinit-install.zsh/.zinit-install-completions + |   `-- zinit-install.zsh/.zinit-forget-completion `-- zinit-autoload.zsh/.zinit-module Uses feature(s): _add-zsh-hook_, _alias_, _autoload_, _bindkey_, _colors_, _export_, _is-at-least_, _setopt_, _source_, _zle_, _zmodload_, _zstyle_ _Exports (environment):_ PMSPEC [big]*//* ZPFX [big]*//* ZSH_CACHE_DIR -==== +zi-log +==== +zi-cmp-reinstall ____ @@ -218,13 +234,31 @@ ____ ____ -Has 1 line(s). Calls functions: +Has 5 line(s). Calls functions: - +zi-log - `-- +zinit-message + +zi-cmp-reinstall + |-- compinit + `-- zinit-install.zsh/.zinit-install-completions + +Uses feature(s): _autoload_, _compinit_, _source_ Called by: + zinit + +==== +zi-log + +____ + + Logging function + +____ + +Has 16 line(s). Doesn't call other functions. + +Called by: + + +zinit-message zinit-additional.zsh/.zinit-debug-clear zinit-additional.zsh/.zinit-debug-report zinit-additional.zsh/.zinit-debug-revert @@ -233,6 +267,7 @@ Called by: zinit-additional.zsh/.zinit-debug-stop zinit-additional.zsh/:zinit-tmp-subst-source zinit-autoload.zsh/.zinit-unload + zinit-install.zsh/.zinit-install-completions ==== +zinit-deploy-message @@ -257,15 +292,17 @@ Called by: ____ - Logging function + Wrapper function for +zinit-message until migrated to +zi-log ____ -Has 16 line(s). Doesn't call other functions. +Has 1 line(s). Calls functions: + + +zinit-message + `-- +zi-log Called by: - +zi-log +zinit-prehelp-usage-message .zinit-compdef-clear .zinit-compdef-replay @@ -316,6 +353,7 @@ Has 38 line(s). Calls functions: +zinit-prehelp-usage-message `-- +zinit-message + `-- +zi-log Called by: @@ -425,7 +463,6 @@ Called by: 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 zinit-side.zsh/.zinit-any-colorify-as-uspl2 zinit-side.zsh/.zinit-compute-ice zinit-side.zsh/.zinit-exists-physically-message @@ -444,6 +481,7 @@ Has 3 line(s). Calls functions: .zinit-compdef-clear `-- +zinit-message + `-- +zi-log Called by: @@ -463,6 +501,7 @@ Has 17 line(s). Calls functions: .zinit-compdef-replay `-- +zinit-message + `-- +zi-log Uses feature(s): _compdef_ @@ -727,12 +766,14 @@ Has 95 line(s). Calls functions: |   |-- .zinit-tmp-subst-on |   `-- :zinit-tmp-subst-autoload |   |-- +zinit-message + |   |   `-- +zi-log |   |-- .zinit-add-report |   |-- .zinit-any-to-user-plugin |   `-- is-at-least |-- .zinit-load-snippet |   |-- +zinit-deploy-message |   |-- +zinit-message + |   |   `-- +zi-log |   |-- .zinit-add-report |   |-- .zinit-find-other-matches |   |-- .zinit-get-object-path @@ -740,13 +781,16 @@ Has 95 line(s). Calls functions: |   |-- .zinit-pack-ice |   |-- .zinit-set-m-func |   |   `-- +zinit-message + |   |   `-- +zi-log |   |-- .zinit-setup-params |   `-- zinit-install.zsh/.zinit-download-snippet |-- .zinit-pack-ice |-- .zinit-register-plugin |   `-- +zinit-message + |   `-- +zi-log |-- .zinit-set-m-func |   `-- +zinit-message + |   `-- +zi-log |-- .zinit-setup-params |-- zinit-install.zsh/.zinit-get-package `-- zinit-install.zsh/.zinit-setup-plugin-dir @@ -792,12 +836,14 @@ Has 12 line(s). Calls functions: |   |   |-- .zinit-tmp-subst-on |   |   `-- :zinit-tmp-subst-autoload |   |   |-- +zinit-message + |   |   |   `-- +zi-log |   |   |-- .zinit-add-report |   |   |-- .zinit-any-to-user-plugin |   |   `-- is-at-least |   |-- .zinit-load-snippet |   |   |-- +zinit-deploy-message |   |   |-- +zinit-message + |   |   |   `-- +zi-log |   |   |-- .zinit-add-report |   |   |-- .zinit-find-other-matches |   |   |-- .zinit-get-object-path @@ -805,19 +851,23 @@ Has 12 line(s). Calls functions: |   |   |-- .zinit-pack-ice |   |   |-- .zinit-set-m-func |   |   |   `-- +zinit-message + |   |   |   `-- +zi-log |   |   |-- .zinit-setup-params |   |   `-- zinit-install.zsh/.zinit-download-snippet |   |-- .zinit-pack-ice |   |-- .zinit-register-plugin |   |   `-- +zinit-message + |   |   `-- +zi-log |   |-- .zinit-set-m-func |   |   `-- +zinit-message + |   |   `-- +zi-log |   |-- .zinit-setup-params |   |-- zinit-install.zsh/.zinit-get-package |   `-- zinit-install.zsh/.zinit-setup-plugin-dir `-- .zinit-load-snippet |-- +zinit-deploy-message |-- +zinit-message + |   `-- +zi-log |-- .zinit-add-report |-- .zinit-find-other-matches |-- .zinit-get-object-path @@ -825,6 +875,7 @@ Has 12 line(s). Calls functions: |-- .zinit-pack-ice |-- .zinit-set-m-func |   `-- +zinit-message + |   `-- +zi-log |-- .zinit-setup-params `-- zinit-install.zsh/.zinit-download-snippet @@ -859,6 +910,7 @@ Has 128 line(s). Calls functions: |-- .zinit-tmp-subst-on `-- :zinit-tmp-subst-autoload |-- +zinit-message + |   `-- +zi-log |-- .zinit-add-report |-- .zinit-any-to-user-plugin `-- is-at-least @@ -884,6 +936,7 @@ Has 203 line(s). Calls functions: .zinit-load-snippet |-- +zinit-deploy-message |-- +zinit-message + |   `-- +zi-log |-- .zinit-add-report |-- .zinit-find-other-matches |-- .zinit-get-object-path @@ -891,6 +944,7 @@ Has 203 line(s). Calls functions: |-- .zinit-pack-ice |-- .zinit-set-m-func |   `-- +zinit-message + |   `-- +zi-log |-- .zinit-setup-params `-- zinit-install.zsh/.zinit-download-snippet @@ -974,6 +1028,7 @@ Has 23 line(s). Calls functions: .zinit-register-plugin `-- +zinit-message + `-- +zi-log Called by: @@ -992,6 +1047,7 @@ Has 24 line(s). Calls functions: .zinit-run |-- +zinit-message + |   `-- +zi-log |-- .zinit-any-to-user-plugin `-- .zinit-get-object-path `-- .zinit-any-to-user-plugin @@ -1039,12 +1095,14 @@ Has 47 line(s). Calls functions: |   |   |-- .zinit-tmp-subst-on |   |   `-- :zinit-tmp-subst-autoload |   |   |-- +zinit-message + |   |   |   `-- +zi-log |   |   |-- .zinit-add-report |   |   |-- .zinit-any-to-user-plugin |   |   `-- is-at-least |   |-- .zinit-load-snippet |   |   |-- +zinit-deploy-message |   |   |-- +zinit-message + |   |   |   `-- +zi-log |   |   |-- .zinit-add-report |   |   |-- .zinit-find-other-matches |   |   |-- .zinit-get-object-path @@ -1052,19 +1110,23 @@ Has 47 line(s). Calls functions: |   |   |-- .zinit-pack-ice |   |   |-- .zinit-set-m-func |   |   |   `-- +zinit-message + |   |   |   `-- +zi-log |   |   |-- .zinit-setup-params |   |   `-- zinit-install.zsh/.zinit-download-snippet |   |-- .zinit-pack-ice |   |-- .zinit-register-plugin |   |   `-- +zinit-message + |   |   `-- +zi-log |   |-- .zinit-set-m-func |   |   `-- +zinit-message + |   |   `-- +zi-log |   |-- .zinit-setup-params |   |-- zinit-install.zsh/.zinit-get-package |   `-- zinit-install.zsh/.zinit-setup-plugin-dir |-- .zinit-load-snippet |   |-- +zinit-deploy-message |   |-- +zinit-message + |   |   `-- +zi-log |   |-- .zinit-add-report |   |-- .zinit-find-other-matches |   |-- .zinit-get-object-path @@ -1072,6 +1134,7 @@ Has 47 line(s). Calls functions: |   |-- .zinit-pack-ice |   |-- .zinit-set-m-func |   |   `-- +zinit-message + |   |   `-- +zi-log |   |-- .zinit-setup-params |   `-- zinit-install.zsh/.zinit-download-snippet `-- zinit-autoload.zsh/.zinit-unload @@ -1095,6 +1158,7 @@ Has 17 line(s). Calls functions: .zinit-set-m-func `-- +zinit-message + `-- +zi-log Uses feature(s): _setopt_ @@ -1243,6 +1307,7 @@ Has 111 line(s). Calls functions: :zinit-tmp-subst-autoload |-- +zinit-message + |   `-- +zi-log |-- .zinit-add-report |-- .zinit-any-to-user-plugin `-- is-at-least @@ -1338,6 +1403,7 @@ Has 4 line(s). Calls functions: @autoload `-- :zinit-tmp-subst-autoload |-- +zinit-message + |   `-- +zi-log |-- .zinit-add-report |-- .zinit-any-to-user-plugin `-- is-at-least @@ -1415,12 +1481,14 @@ Has 75 line(s). *Is a precmd hook*. Calls functions: |   |   |   |-- .zinit-tmp-subst-on |   |   |   `-- :zinit-tmp-subst-autoload |   |   |   |-- +zinit-message + |   |   |   |   `-- +zi-log |   |   |   |-- .zinit-add-report |   |   |   |-- .zinit-any-to-user-plugin |   |   |   `-- is-at-least |   |   |-- .zinit-load-snippet |   |   |   |-- +zinit-deploy-message |   |   |   |-- +zinit-message + |   |   |   |   `-- +zi-log |   |   |   |-- .zinit-add-report |   |   |   |-- .zinit-find-other-matches |   |   |   |-- .zinit-get-object-path @@ -1428,19 +1496,23 @@ Has 75 line(s). *Is a precmd hook*. Calls functions: |   |   |   |-- .zinit-pack-ice |   |   |   |-- .zinit-set-m-func |   |   |   |   `-- +zinit-message + |   |   |   |   `-- +zi-log |   |   |   |-- .zinit-setup-params |   |   |   `-- zinit-install.zsh/.zinit-download-snippet |   |   |-- .zinit-pack-ice |   |   |-- .zinit-register-plugin |   |   |   `-- +zinit-message + |   |   |   `-- +zi-log |   |   |-- .zinit-set-m-func |   |   |   `-- +zinit-message + |   |   |   `-- +zi-log |   |   |-- .zinit-setup-params |   |   |-- zinit-install.zsh/.zinit-get-package |   |   `-- zinit-install.zsh/.zinit-setup-plugin-dir |   |-- .zinit-load-snippet |   |   |-- +zinit-deploy-message |   |   |-- +zinit-message + |   |   |   `-- +zi-log |   |   |-- .zinit-add-report |   |   |-- .zinit-find-other-matches |   |   |-- .zinit-get-object-path @@ -1448,6 +1520,7 @@ Has 75 line(s). *Is a precmd hook*. Calls functions: |   |   |-- .zinit-pack-ice |   |   |-- .zinit-set-m-func |   |   |   `-- +zinit-message + |   |   |   `-- +zi-log |   |   |-- .zinit-setup-params |   |   `-- zinit-install.zsh/.zinit-download-snippet |   `-- zinit-autoload.zsh/.zinit-unload @@ -1514,6 +1587,7 @@ Has 15 line(s). Calls functions: `-- .zinit-load-snippet |-- +zinit-deploy-message |-- +zinit-message + |   `-- +zi-log |-- .zinit-add-report |-- .zinit-find-other-matches |-- .zinit-get-object-path @@ -1521,6 +1595,7 @@ Has 15 line(s). Calls functions: |-- .zinit-pack-ice |-- .zinit-set-m-func |   `-- +zinit-message + |   `-- +zi-log |-- .zinit-setup-params `-- zinit-install.zsh/.zinit-download-snippet @@ -1542,6 +1617,7 @@ Has 1 line(s). Calls functions: zicdclear `-- .zinit-compdef-clear `-- +zinit-message + `-- +zi-log Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). @@ -1559,6 +1635,7 @@ Has 1 line(s). Calls functions: zicdreplay `-- .zinit-compdef-replay `-- +zinit-message + `-- +zi-log Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). @@ -1603,18 +1680,25 @@ ____ ____ -Has 553 line(s). Calls functions: +Has 519 line(s). Calls functions: zinit + |-- +zi-cmp-reinstall + |   |-- compinit + |   `-- zinit-install.zsh/.zinit-install-completions |-- +zinit-message + |   `-- +zi-log |-- +zinit-prehelp-usage-message |   `-- +zinit-message + |   `-- +zi-log |-- .zinit-add-fpath |   `-- .zinit-any-to-user-plugin |-- .zinit-compdef-clear |   `-- +zinit-message + |   `-- +zi-log |-- .zinit-compdef-replay |   `-- +zinit-message + |   `-- +zi-log |-- .zinit-get-object-path |   `-- .zinit-any-to-user-plugin |-- .zinit-ice @@ -1638,12 +1722,14 @@ Has 553 line(s). Calls functions: |   |   |   |-- .zinit-tmp-subst-on |   |   |   `-- :zinit-tmp-subst-autoload |   |   |   |-- +zinit-message + |   |   |   |   `-- +zi-log |   |   |   |-- .zinit-add-report |   |   |   |-- .zinit-any-to-user-plugin |   |   |   `-- is-at-least |   |   |-- .zinit-load-snippet |   |   |   |-- +zinit-deploy-message |   |   |   |-- +zinit-message + |   |   |   |   `-- +zi-log |   |   |   |-- .zinit-add-report |   |   |   |-- .zinit-find-other-matches |   |   |   |-- .zinit-get-object-path @@ -1651,19 +1737,23 @@ Has 553 line(s). Calls functions: |   |   |   |-- .zinit-pack-ice |   |   |   |-- .zinit-set-m-func |   |   |   |   `-- +zinit-message + |   |   |   |   `-- +zi-log |   |   |   |-- .zinit-setup-params |   |   |   `-- zinit-install.zsh/.zinit-download-snippet |   |   |-- .zinit-pack-ice |   |   |-- .zinit-register-plugin |   |   |   `-- +zinit-message + |   |   |   `-- +zi-log |   |   |-- .zinit-set-m-func |   |   |   `-- +zinit-message + |   |   |   `-- +zi-log |   |   |-- .zinit-setup-params |   |   |-- zinit-install.zsh/.zinit-get-package |   |   `-- zinit-install.zsh/.zinit-setup-plugin-dir |   `-- .zinit-load-snippet |   |-- +zinit-deploy-message |   |-- +zinit-message + |   |   `-- +zi-log |   |-- .zinit-add-report |   |-- .zinit-find-other-matches |   |-- .zinit-get-object-path @@ -1671,11 +1761,13 @@ Has 553 line(s). Calls functions: |   |-- .zinit-pack-ice |   |-- .zinit-set-m-func |   |   `-- +zinit-message + |   |   `-- +zi-log |   |-- .zinit-setup-params |   `-- zinit-install.zsh/.zinit-download-snippet |-- .zinit-parse-opts |-- .zinit-run |   |-- +zinit-message + |   |   `-- +zi-log |   |-- .zinit-any-to-user-plugin |   `-- .zinit-get-object-path |   `-- .zinit-any-to-user-plugin @@ -1710,8 +1802,7 @@ Has 553 line(s). Calls functions: |-- zinit-autoload.zsh/zi::version |-- zinit-install.zsh/.zinit-compile-plugin |-- zinit-install.zsh/.zinit-compinit - |-- zinit-install.zsh/.zinit-forget-completion - `-- zinit-install.zsh/.zinit-install-completions + `-- zinit-install.zsh/.zinit-forget-completion Uses feature(s): _autoload_, _compinit_, _eval_, _setopt_, _source_ @@ -1728,6 +1819,7 @@ Has 1 line(s). Calls functions: zpcdclear `-- .zinit-compdef-clear `-- +zinit-message + `-- +zi-log Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). @@ -1738,6 +1830,7 @@ Has 1 line(s). Calls functions: zpcdreplay `-- .zinit-compdef-replay `-- +zinit-message + `-- +zi-log Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). @@ -1764,15 +1857,22 @@ Has 1 line(s). Calls functions: zplugin `-- zinit + |-- +zi-cmp-reinstall + |   |-- compinit + |   `-- zinit-install.zsh/.zinit-install-completions |-- +zinit-message + |   `-- +zi-log |-- +zinit-prehelp-usage-message |   `-- +zinit-message + |   `-- +zi-log |-- .zinit-add-fpath |   `-- .zinit-any-to-user-plugin |-- .zinit-compdef-clear |   `-- +zinit-message + |   `-- +zi-log |-- .zinit-compdef-replay |   `-- +zinit-message + |   `-- +zi-log |-- .zinit-get-object-path |   `-- .zinit-any-to-user-plugin |-- .zinit-ice @@ -1796,12 +1896,14 @@ Has 1 line(s). Calls functions: |   |   |   |-- .zinit-tmp-subst-on |   |   |   `-- :zinit-tmp-subst-autoload |   |   |   |-- +zinit-message + |   |   |   |   `-- +zi-log |   |   |   |-- .zinit-add-report |   |   |   |-- .zinit-any-to-user-plugin |   |   |   `-- is-at-least |   |   |-- .zinit-load-snippet |   |   |   |-- +zinit-deploy-message |   |   |   |-- +zinit-message + |   |   |   |   `-- +zi-log |   |   |   |-- .zinit-add-report |   |   |   |-- .zinit-find-other-matches |   |   |   |-- .zinit-get-object-path @@ -1809,19 +1911,23 @@ Has 1 line(s). Calls functions: |   |   |   |-- .zinit-pack-ice |   |   |   |-- .zinit-set-m-func |   |   |   |   `-- +zinit-message + |   |   |   |   `-- +zi-log |   |   |   |-- .zinit-setup-params |   |   |   `-- zinit-install.zsh/.zinit-download-snippet |   |   |-- .zinit-pack-ice |   |   |-- .zinit-register-plugin |   |   |   `-- +zinit-message + |   |   |   `-- +zi-log |   |   |-- .zinit-set-m-func |   |   |   `-- +zinit-message + |   |   |   `-- +zi-log |   |   |-- .zinit-setup-params |   |   |-- zinit-install.zsh/.zinit-get-package |   |   `-- zinit-install.zsh/.zinit-setup-plugin-dir |   `-- .zinit-load-snippet |   |-- +zinit-deploy-message |   |-- +zinit-message + |   |   `-- +zi-log |   |-- .zinit-add-report |   |-- .zinit-find-other-matches |   |-- .zinit-get-object-path @@ -1829,11 +1935,13 @@ Has 1 line(s). Calls functions: |   |-- .zinit-pack-ice |   |-- .zinit-set-m-func |   |   `-- +zinit-message + |   |   `-- +zi-log |   |-- .zinit-setup-params |   `-- zinit-install.zsh/.zinit-download-snippet |-- .zinit-parse-opts |-- .zinit-run |   |-- +zinit-message + |   |   `-- +zi-log |   |-- .zinit-any-to-user-plugin |   `-- .zinit-get-object-path |   `-- .zinit-any-to-user-plugin @@ -1868,8 +1976,7 @@ Has 1 line(s). Calls functions: |-- zinit-autoload.zsh/zi::version |-- zinit-install.zsh/.zinit-compile-plugin |-- zinit-install.zsh/.zinit-compinit - |-- zinit-install.zsh/.zinit-forget-completion - `-- zinit-install.zsh/.zinit-install-completions + `-- zinit-install.zsh/.zinit-forget-completion Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). @@ -1908,7 +2015,7 @@ ____ ____ -Has 117 line(s). Doesn't call other functions. +Has 120 line(s). Doesn't call other functions. Called by: @@ -1931,12 +2038,13 @@ ____ ____ -Has 549 line(s). Doesn't call other functions. +Has 573 line(s). Doesn't call other functions. Uses feature(s): _autoload_, _bindkey_, _compdef_, _compdump_, _eval_, _read_, _setopt_, _unfunction_, _zle_, _zstyle_ Called by: + +zi-cmp-reinstall zicompinit zinit zpcompinit diff --git a/zinit-install.zsh b/zinit-install.zsh index 09cd8e39a..7d770d5c4 100644 --- a/zinit-install.zsh +++ b/zinit-install.zsh @@ -522,65 +522,68 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || { return 0 } # ]]] # FUNCTION: .zinit-install-completions [[[ -# Installs all completions of given plugin. After that they are -# visible to 'compinit'. Visible completions can be selectively -# disabled and enabled. User can access completion data with -# 'clist' or 'completions' subcommand. +# Installs plugin completions. # # $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin) # $2 - plugin if $1 (i.e., user) given # $3 - if 1, then reinstall, otherwise only install completions that are not present -.zinit-install-completions() { +# +.zinit-install-completions () { builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace} - setopt nullglob extendedglob warncreateglobal typesetsilent noshortloops - - local id_as=$1${2:+${${${(M)1:#%}:+$2}:-/$2}} - local reinstall=${3:-0} quiet=${${4:+1}:-0} - (( OPTS[opt_-q,--quiet] )) && quiet=1 - [[ $4 = -Q ]] && quiet=2 - typeset -ga INSTALLED_COMPS SKIPPED_COMPS - INSTALLED_COMPS=() SKIPPED_COMPS=() - - .zinit-any-to-user-plugin "$id_as" "" - local user=${reply[-2]} - local plugin=${reply[-1]} - .zinit-any-colorify-as-uspl2 "$user" "$plugin" - local abbrev_pspec=$REPLY - - .zinit-exists-physically-message "$id_as" "" || return 1 - - # Symlink any completion files included in the plugin directory - typeset -a completions already_symlinked backup_comps - local c cfile bkpfile - # The plugin == . is a semi-hack/trick to handle 'creinstall .' properly - [[ $user == % || ( -z $user && $plugin == . ) ]] && \ - completions=( "${plugin}"/**/_[^_.]*~*(*.zwc|*.html|*.txt|*.png|*.jpg|*.jpeg|*.js|*.md|*.yml|*.ri|_zsh_highlight*|/zsdoc/*|*.ps1)(DN^/) ) || \ - completions=( "${ZINIT[PLUGINS_DIR]}/${id_as//\//---}"/**/_[^_.]*~*(*.zwc|*.html|*.txt|*.png|*.jpg|*.jpeg|*.js|*.md|*.yml|*.ri|_zsh_highlight*|/zsdoc/*|*.ps1)(DN^/) ) - already_symlinked=( "${ZINIT[COMPLETIONS_DIR]}"/_[^_.]*~*.zwc(DN) ) - backup_comps=( "${ZINIT[COMPLETIONS_DIR]}"/[^_.]*~*.zwc(DN) ) - - # Symlink completions if they are not already there - # either as completions (_fname) or as backups (fname) - # OR - if its a reinstall + setopt extendedglob noshortloops nullglob typesetsilent warncreateglobal + + local all force help quiet reinstall + builtin zparseopts -D \ + {a,-all}=all \ + {h,-help}=help \ + {f,-force}=force \ + {q,-quiet}=quiet + if (( ! $# )); then + +zi-log '{e} One argument or {opt}--all{rst} required' + return 0 + elif [[ -n $help ]]; then + +zi-log 'Usage: {cmd}zinit creinstall{rst} [options]{nl}' + +zi-log "Options:" + +zi-log " -a, --all List all packages in the index" + +zi-log " -f, --force Hide the 'package installed' indicator" + +zi-log " -h, --help Output this help text and exit" + +zi-log " -q, --quiet Hide the 'package installed' indicator" + return 0 + fi + + typeset -ga INSTALLED_COMPS=() SKIPPED_COMPS=() + .zinit-any-to-user-plugin "$1" + local user=${reply[-2]} plugin=${reply[-1]} + .zinit-exists-physically-message "$1" "" || return 1 + typeset -a already_symlinked backup_comps completions + local bkpfile c cfile + local cmp_ignore='*.(html|jpeg|jpg|js|lua|md|png|ps1|ri|txt|yml|zwc|/zsdoc/*|_zsh_highlight*)' + + if [[ $user == % || ( -z $user && $plugin == . ) ]]; then + completions=("$plugin"/**/_[^_.]*~*${~cmp_ignore}(DN^/)) + else + completions=("${ZINIT[PLUGINS_DIR]}/${1//\//---}"/**/_[^_.]*~*${~cmp_ignore}(DN^/)) + fi + + already_symlinked=("${ZINIT[COMPLETIONS_DIR]}"/_[^_.]*~*.zwc(DN)) + backup_comps=("${ZINIT[COMPLETIONS_DIR]}"/[^_.]*~*.zwc(DN)) for c in "${completions[@]:A}"; do cfile="${c:t}" bkpfile="${cfile#_}" - if [[ ( -z ${already_symlinked[(r)*/$cfile]} || $reinstall = 1 ) && - -z ${backup_comps[(r)*/$bkpfile]} - ]]; then - if [[ $reinstall = 1 ]]; then - # Remove old files - command rm -f "${ZINIT[COMPLETIONS_DIR]}/$cfile" "${ZINIT[COMPLETIONS_DIR]}/$bkpfile" + if [[ ( -z ${already_symlinked[(r)*/$cfile]} || -n $force ) && -z ${backup_comps[(r)*/$bkpfile]} ]]; then + if [[ -z $force ]]; then + command rm -f "${ZINIT[COMPLETIONS_DIR]}/"{$cfile,$bkpfile} fi - INSTALLED_COMPS+=( $cfile ) - (( quiet )) || builtin print -Pr "Symlinking completion ${ZINIT[col-uname]}$cfile%f%b to completions directory." + INSTALLED_COMPS+=($cfile) + [[ -z $quiet ]] && +zi-log "{m} Created link of $cfile in completions directory" command ln -fs "$c" "${ZINIT[COMPLETIONS_DIR]}/$cfile" - # Make compinit notice the change - .zinit-forget-completion "$cfile" "$quiet" + .zinit-forget-completion "$cfile" else - SKIPPED_COMPS+=( $cfile ) - (( quiet )) || builtin print -Pr "Not symlinking completion \`${ZINIT[col-obj]}$cfile%f%b', it already exists." - (( quiet )) || builtin print -Pr "${ZINIT[col-info2]}Use \`${ZINIT[col-pname]}zinit creinstall $abbrev_pspec${ZINIT[col-info2]}' to force install.%f%b" + SKIPPED_COMPS+=($cfile) + [[ -z $quiet ]] && { + +zi-log "{w} $cfile is already installed." + +zi-log "To reinstall $cfile, run:{nl}{tab}{cmd}zinit creinstall --force $id_as{rst}" + } fi done @@ -590,18 +593,18 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || { local comps_num=${#${(e)comps}} if (( comps_num > 0 )); then +zinit-message "{m} ${msg} {num}$comps_num{rst} completion${=${comps_num:#1}:+s}" - if (( quiet == 0 )); then - +zinit-message "{m} Added $comps_num completion${=${comps_num:#1}:+s} to {var}$comps{rst} array" - fi + [[ -z quiet ]] && { + +zi-log "{m} Added $comps_num completion${=${comps_num:#1}:+s} to {var}$comps{rst} array" + } fi done - if (( ZSH_SUBSHELL )) { - builtin print -rl -- $INSTALLED_COMPS >! ${TMPDIR:-/tmp}/zinit.installed_comps.$$.lst - builtin print -rl -- $SKIPPED_COMPS >! ${TMPDIR:-/tmp}/zinit.skipped_comps.$$.lst - } + if (( ZSH_SUBSHELL )); then + builtin print -rl -- $INSTALLED_COMPS >| ${TMPDIR:-/tmp}/zinit.installed_comps.$$.lst + builtin print -rl -- $SKIPPED_COMPS >| ${TMPDIR:-/tmp}/zinit.skipped_comps.$$.lst + fi - .zinit-compinit 1 1 &>/dev/null + .zinit-compinit 1 1 &> /dev/null } # ]]] # FUNCTION: .zinit-compinit [[[ # User-exposed `compinit' frontend which first ensures that all @@ -796,7 +799,7 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || { builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace} setopt extendedglob typesetsilent warncreateglobal - local f="$1" quiet="$2" + local f="$1" quiet="${2:-0}" typeset -a commands commands=( ${(k)_comps[(Re)$f]} ) diff --git a/zinit.zsh b/zinit.zsh index 267381dde..11d3ce594 100644 --- a/zinit.zsh +++ b/zinit.zsh @@ -2156,9 +2156,9 @@ builtin setopt noaliases # REPLY+="x(${3}…)" } # ]]] -# FUNCTION: +zinit-message [[[ +# FUNCTION: +zi-log [[[ # Logging function -+zinit-message() { ++zi-log() { builtin emulate -LR zsh -o extendedglob ${=${options[xtrace]:#off}:+-o xtrace} local opt msg [[ $1 = -* ]] && { local opt=$1; shift; } @@ -2189,10 +2189,20 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→} print -n $'\015' fi } # ]]] -# FUNCTION: +zi-log [[[ +# FUNCTION: +zinit-message [[[ # Wrapper function for +zinit-message until migrated to +zi-log -+zi-log(){ - +zinit-message $@ ++zinit-message(){ + +zi-log $@ +} # ]]] + +# FUNCTION: +zi-cmp-reinstall [[[ +# Wrapper function for +zinit-message until migrated to +zi-log ++zi-cmp-reinstall(){ + (( ${+functions[.zinit-install-completions]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-install.zsh" || return 1 + shift + .zinit-install-completions $@ + builtin autoload -Uz compinit + compinit -d "${ZINIT[ZCOMPDUMP_PATH]:-${ZDOTDIR:-$HOME}}/.zcompdump" "${(Q@)${(z@)ZINIT[COMPINIT_OPTS]}}" } # ]]] # FUNCTION: +zinit-prehelp-usage-message [[[ @@ -2538,246 +2548,156 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→} # and completion. 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 +2709,124 @@ 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 (zstatus) .zinit-show-zstatus ;; @@ -2929,51 +2843,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 +2913,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 +2938,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" @@ -3025,21 +2954,16 @@ You can try to prepend {apo}${___q}{lhi}@{apo}'{error} to the ID if the last ice fi ;; (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=$? - [[ -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]}}" + +zi-cmp-reinstall $@ ;; (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 +2974,39 @@ 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; + 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,11 +3016,13 @@ 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=$? + .zinit-recently "$@" + ___retval=$? ;; (-h|--help|help) .zinit-help @@ -3094,34 +3031,40 @@ You can try to prepend {apo}${___q}{lhi}@{apo}'{error} to the ID if the last ice zi::version ;; (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 [[[ @@ -3305,10 +3248,4 @@ zle -N zi-browse-symbol-pforwards zi-browse-symbol zstyle -s ':zinit:browse-symbol' key ZINIT_TMP || ZINIT_TMP='\eQ' [[ -n $ZINIT_TMP ]] && bindkey $ZINIT_TMP zi-browse-symbol -# Local Variables: -# mode: Shell-Script -# sh-indentation: 2 -# indent-tabs-mode: nil -# sh-basic-offset: 2 -# End: -# vim: ft=zsh sw=2 ts=2 et foldmarker=[[[,]]] foldmethod=marker +# vim: ft=zsh sw=4 ts=4 et foldmarker=[[[,]]] foldmethod=marker