Skip to content

Commit

Permalink
maint: print is faster than a heredoc
Browse files Browse the repository at this point in the history
Signed-off-by: Doster, Vladislav <[email protected]>
  • Loading branch information
vladdoster committed Jun 8, 2023
1 parent 476ff85 commit abd968b
Showing 1 changed file with 61 additions and 66 deletions.
127 changes: 61 additions & 66 deletions zinit-autoload.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -1413,74 +1413,69 @@ EOF
#
# User-action entry point.
.zinit-help() {
cat <<EOF
Usage: zinit [OPTIONS] COMMAND
Zinit is a plugin management system for zsh.
Commands:
bindkeys Lists bindkeys set up by each plugin
cd Change directory to a plugin or snippet
cdclear Clear compdef replay list
cdisable Disable completion
cdlist Show compdef replay list
cdreplay Replay compdefs
cenable Enable completion
changes View plugin's git log
compile Compile plugin
compiled List plugins that are compiled
compinit Refresh installed completions
completions List completions in use
create Create plugin (also together with Github repository)
creinstall Install a plugin or local completion
csearch Search for available completions from any plugin
cuninstall Uninstall completions for plugin
debug Manage debug mode
delete Delete a plugin or snippet
edit Edit plugin's file with \$EDITOR
glance Look at plugin's source
help Usage information
ice Add ICE to next command
light Light plugin load, without reporting/tracking
load Load plugin, can also receive absolute local path
man Manual
module Manage binary zsh module shipped with zinit
plugins List currently installed plugins
recall Fetch saved ice modifiers and construct 'zinit ice ...' command
recently Show plugins that changed recently
report Show plugin's report
self-update Update zinit
snippet Source local or remote file (by direct URL)
snippets List currently installed snippets
status Git status for plugin or svn status for snippet
stress Test plugin for compatibility with set of options
times Statistics on plugin load times, sorted in order of loading
uncompile Remove compiled version of plugin
unload Unload plugin
update Update a plugin or snippet
version Display zinit version
zstatus Overall zinit status
EOF

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]}')"; }
print -- "Usage: zinit [OPTIONS] COMMAND"
print -- ""
print -- "Zinit is a plugin management system for zsh."
print -- ""
print -- "Commands:"
print -- " bindkeys Lists bindkeys set up by each plugin"
print -- " cd Change directory to a plugin or snippet"
print -- " cdclear Clear compdef replay list"
print -- " cdisable Disable completion"
print -- " cdlist Show compdef replay list"
print -- " cdreplay Replay compdefs"
print -- " cenable Enable completion"
print -- " changes View plugin's git log"
print -- " compile Compile plugin"
print -- " compiled List plugins that are compiled"
print -- " compinit Refresh installed completions"
print -- " completions List completions in use"
print -- " create Create plugin (also together with Github repository)"
print -- " creinstall Install a plugin or local completion"
print -- " csearch Search for available completions from any plugin"
print -- " cuninstall Uninstall completions for plugin"
print -- " debug Manage debug mode"
print -- " delete Delete a plugin or snippet"
print -- " edit Edit plugin's file with \$EDITOR"
print -- " glance Look at plugin's source"
print -- " help Usage information"
print -- " ice Add ICE to next command"
print -- " light Light plugin load, without reporting/tracking"
print -- " load Load plugin, can also receive absolute local path"
print -- " man Manual"
print -- " module Manage binary zsh module shipped with zinit"
print -- " plugins List currently installed plugins"
print -- " recall Fetch saved ice modifiers and construct "zinit ice ..." command"
print -- " recently Show plugins that changed recently"
print -- " report Show plugin's report"
print -- " self-update Update zinit"
print -- " snippet Source local or remote file (by direct URL)"
print -- " snippets List currently installed snippets"
print -- " status Git status for plugin or svn status for snippet"
print -- " stress Test plugin for compatibility with set of options"
print -- " times Statistics on plugin load times, sorted in order of loading"
print -- " uncompile Remove compiled version of plugin"
print -- " unload Unload plugin"
print -- " update Update a plugin or snippet"
print -- " version Display zinit version"
print -- " zstatus Overall zinit status"

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
done
done

cat <<EOF
Run 'zinit COMMAND --help' for more information on a command.

For more help on how to use Zinit, head to https://github.com/zdharma_continuum/zinit'.
EOF
print -- "Run 'zinit COMMAND --help' for more information on a command."
print -- ''
print -- "For more help on how to use Zinit, head to https://github.com/zdharma_continuum/zinit'."
} # ]]]

# FUNCTION: .zinit-list-bindkeys [[[
Expand Down

0 comments on commit abd968b

Please sign in to comment.