Skip to content

Commit 0e691c0

Browse files
committed
fix: re-format zinit usage message
Signed-off-by: Doster, Vladislav <[email protected]>
1 parent 497d519 commit 0e691c0

10 files changed

+373
-417
lines changed

Makefile

+1-30
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,11 @@ container:
1313
docker build --tag=ghcr.io/zdharma-continuum/zinit:latest --file=docker/Dockerfile .
1414

1515
doc: clean
16-
cd doc; zsh -l -d -f -i -c "zsd -v --scomm --cignore '(\#*FUNCTION:[[:space:]][\:\∞\.\+\@\-a-zA-Z0-9]*[\[]*|}[[:space:]]\#[[:space:]][\]]*)' $(DOC_SRC)"
16+
cd doc; zsh -l -d -f -i -c "zsd -v --scomm --cignore '(\#*FUNCTION:[[:space:]][\:\∞\_\.\+\@\-a-zA-Z0-9]*[\[]*|}[[:space:]]\#[[:space:]][\]]*)' $(DOC_SRC)"
1717

1818
doc/container: container
1919
./scripts/docker-run.sh --docs --debug
2020

21-
# Run ctags to generate Emacs and Vim's format tag file.
22-
tags: tags/emacs tags/vim
23-
24-
tags/emacs: ## Build Emacs-style ctags file
25-
@if type ctags >/dev/null 2>&1; then \
26-
if ctags --version | grep >/dev/null 2>&1 "Universal Ctags"; then \
27-
ctags -e -R --options=share/zsh.ctags --languages=zsh \
28-
--pattern-length-limit=250 --maxdepth=1; \
29-
else \
30-
ctags -e -R --languages=sh --langmap=sh:.zsh; \
31-
fi; \
32-
printf "Created the Emacs \`TAGS\` file.\\n"; \
33-
else \
34-
printf 'Error: Please install a Ctags (e.g.: either the Exuberant or Universal %b' \
35-
'version) utility first.\n'; \
36-
fi
37-
38-
tags/vim: ## Build the Vim-style ctags file
39-
@if type ctags >/dev/null 2>&1; then \
40-
if ctags --version | grep >/dev/null 2>&1 "Universal Ctags"; then \
41-
ctags --languages=zsh --maxdepth=1 --options=share/zsh.ctags --pattern-length-limit=250 -R; \
42-
else \
43-
ctags -R --languages=sh --langmap=sh:.zsh; \
44-
fi; \
45-
printf "Created the Vim's style \`tags\` file.\\n"; \
46-
else \
47-
printf 'Error: Please install a ctags first.\n'; \
48-
fi
49-
5021
test:
5122
zunit run
5223

_zinit

+7-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ __zinit_commands(){
3636
'env-whitelist:Specify names (also patterns) of parameters to be left unchanged during an unload'
3737
'glance:Look at plugins source'
3838
'help:Usage information'
39+
'ice:Set ice'
3940
'load:Load plugin'
4041
'man:Display Zinit'\''s manpage'
4142
'module:Manage binary Zsh module shipped with Zinit'
@@ -236,6 +237,11 @@ _zinit_env_whitelist(){
236237
_zinit_glance(){
237238
_arguments - installed '1:installed:__zinit_installed' && ret=0
238239
} # ]]]
240+
# FUNCTION: _zinit_ice [[[
241+
_zinit_ice(){
242+
_arguments -A \
243+
'(-h --help)'{-h,--help}'[Print usage]' && ret=0
244+
} # ]]]
239245
# FUNCTION: _zinit_list [[[
240246
_zinit_list(){
241247
_message 'Hit enter to list the defined key bindings replay' && ret=0
@@ -279,7 +285,7 @@ _zinit_snippet(){
279285
_arguments -A \
280286
'(-c --command)'{-c,--command}'[Load the snippet as a command (i.e., make executable and apend to $PATH])' \
281287
'(-f --force)'{-f,--force}'[Force new download of the snippet file]' \
282-
'(-h --help)'{-h,--help}'[Show this help message]'
288+
'(-h --help)'{-h,--help}'[Print usage]'
283289
_arguments - snippet '*::snippet:__zinit_installed_snippets' && ret=0
284290
} # ]]]
285291
# FUNCTION: _zinit_status [[[

doc/zsdoc/_zinit.adoc

100644100755
File mode changed.

doc/zsdoc/zinit-autoload.zsh.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ ____
796796
797797
____
798798

799-
Has 64 line(s). Doesn't call other functions.
799+
Has 63 line(s). Doesn't call other functions.
800800

801801
Called by:
802802

doc/zsdoc/zinit-install.zsh.adoc

+6-6
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,10 @@ Has 195 line(s). Calls functions:
302302
|-- .zinit-download-file-stdout
303303
|   `-- zinit.zsh/+zinit-message
304304
|-- .zinit-jq-check
305-
|   `-- zinit.zsh/+zinit-message
305+
|   `-- zinit.zsh/+zi-log
306306
|-- .zinit-json-to-array
307307
|   `-- .zinit-jq-check
308-
|   `-- zinit.zsh/+zinit-message
308+
|   `-- zinit.zsh/+zi-log
309309
|-- ziextract
310310
|   `-- zinit.zsh/+zinit-message
311311
|-- zinit.zsh/+zinit-message
@@ -379,10 +379,10 @@ ____
379379
380380
____
381381

382-
Has 8 line(s). Calls functions:
382+
Has 3 line(s). Calls functions:
383383

384384
.zinit-jq-check
385-
`-- zinit.zsh/+zinit-message
385+
`-- zinit.zsh/+zi-log
386386

387387
Called by:
388388

@@ -405,7 +405,7 @@ Has 4 line(s). Calls functions:
405405

406406
.zinit-json-get-value
407407
`-- .zinit-jq-check
408-
`-- zinit.zsh/+zinit-message
408+
`-- zinit.zsh/+zi-log
409409

410410
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
411411

@@ -426,7 +426,7 @@ Has 13 line(s). Calls functions:
426426

427427
.zinit-json-to-array
428428
`-- .zinit-jq-check
429-
`-- zinit.zsh/+zinit-message
429+
`-- zinit.zsh/+zi-log
430430

431431
Uses feature(s): _eval_, _setopt_
432432

doc/zsdoc/zinit.zsh.adoc

+16-4
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ Has 244 line(s). Calls functions:
110110
|   |-- .zinit-get-object-path
111111
|   |   `-- .zinit-any-to-user-plugin
112112
|   |-- .zinit-ice
113+
|   |   `-- +zi-log
114+
|   |   `-- +zinit-message
113115
|   |-- .zinit-load-ices
114116
|   |   `-- .zinit-get-object-path
115117
|   |   `-- .zinit-any-to-user-plugin
@@ -225,6 +227,7 @@ Has 1 line(s). Calls functions:
225227

226228
Called by:
227229

230+
.zinit-ice
228231
zinit-additional.zsh/.zinit-debug-clear
229232
zinit-additional.zsh/.zinit-debug-report
230233
zinit-additional.zsh/.zinit-debug-revert
@@ -233,6 +236,7 @@ Called by:
233236
zinit-additional.zsh/.zinit-debug-stop
234237
zinit-additional.zsh/:zinit-tmp-subst-source
235238
zinit-autoload.zsh/.zinit-unload
239+
zinit-install.zsh/.zinit-jq-check
236240

237241
==== +zinit-deploy-message
238242

@@ -300,7 +304,6 @@ Called by:
300304
zinit-install.zsh/.zinit-get-latest-gh-r-url-part
301305
zinit-install.zsh/.zinit-get-package
302306
zinit-install.zsh/.zinit-install-completions
303-
zinit-install.zsh/.zinit-jq-check
304307
zinit-install.zsh/.zinit-setup-plugin-dir
305308
zinit-install.zsh/.zinit-update-snippet
306309
zinit-install.zsh/ziextract
@@ -690,9 +693,13 @@ ____
690693
691694
____
692695

693-
Has 13 line(s). Doesn't call other functions.
696+
Has 32 line(s). Calls functions:
694697

695-
Uses feature(s): _setopt_
698+
.zinit-ice
699+
`-- +zi-log
700+
`-- +zinit-message
701+
702+
Uses feature(s): _setopt_, _zmodload_, _zparseopts_
696703

697704
Called by:
698705

@@ -1600,10 +1607,11 @@ ____
16001607
16011608
Entrypoint function directly exposed to user, consumes subcommands with respective arguments,
16021609
and completion.
1610+
16031611
16041612
____
16051613

1606-
Has 553 line(s). Calls functions:
1614+
Has 527 line(s). Calls functions:
16071615

16081616
zinit
16091617
|-- +zinit-message
@@ -1618,6 +1626,8 @@ Has 553 line(s). Calls functions:
16181626
|-- .zinit-get-object-path
16191627
|   `-- .zinit-any-to-user-plugin
16201628
|-- .zinit-ice
1629+
|   `-- +zi-log
1630+
|   `-- +zinit-message
16211631
|-- .zinit-load-ices
16221632
|   `-- .zinit-get-object-path
16231633
|   `-- .zinit-any-to-user-plugin
@@ -1776,6 +1786,8 @@ Has 1 line(s). Calls functions:
17761786
|-- .zinit-get-object-path
17771787
|   `-- .zinit-any-to-user-plugin
17781788
|-- .zinit-ice
1789+
|   `-- +zi-log
1790+
|   `-- +zinit-message
17791791
|-- .zinit-load-ices
17801792
|   `-- .zinit-get-object-path
17811793
|   `-- .zinit-any-to-user-plugin

tests/commands.zunit

+13
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@
1515
assert $output contains 'zinit delete [options] [plugins...]'
1616
assert $state equals 0
1717
}
18+
@test 'zinit help' {
19+
for cmd in '-h' '--help' 'help'; do
20+
run zinit $cmd
21+
assert $output contains 'Usage: zinit [OPTIONS] COMMAND'
22+
assert $state equals 0
23+
done
24+
}
25+
@test 'ice --help' {
26+
run zinit ice --help
27+
assert $output contains 'Usage: zinit ice [-h|--help] [args ...]'
28+
assert $output contains 'Available ice-modifiers:'
29+
assert $state equals 0
30+
}
1831
@test 'delete --all' {
1932
run zinit as'completion' is-snippet for @'https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker'
2033
assert $state equals 0

zinit-autoload.zsh

+49-50
Original file line numberDiff line numberDiff line change
@@ -1413,53 +1413,52 @@ EOF
14131413
#
14141414
# User-action entry point.
14151415
.zinit-help() {
1416-
builtin print -r -- "${ZINIT[col-p]}Usage${ZINIT[col-rst]}:
1417-
—— help – usage information
1418-
—— bindkeys – lists bindkeys set up by each plugin
1419-
—— cd ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – cd into plugin's directory; also support snippets, if feed with URL
1420-
—— cdclear [-q] – clear compdef replay list, -q – quiet
1421-
—— cdisable ${ZINIT[col-info]}cname${ZINIT[col-rst]} – disable completion \`cname'
1422-
—— cdlist – show compdef replay list
1423-
—— cdreplay [-q] – replay compdefs (to be done after compinit), -q – quiet
1424-
—— cenable ${ZINIT[col-info]}cname${ZINIT[col-rst]} – enable completion \`cname'
1425-
—— changes ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – view plugin's git log
1426-
—— clist|completions – list completions in use
1427-
—— compile ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – compile plugin (or all plugins if ——all passed)
1428-
—— compiled – list plugins that are compiled
1429-
—— compinit – refresh installed completions
1430-
—— create ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – create plugin (also together with Github repository)
1431-
—— creinstall ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – install completions for plugin, can also receive absolute local path; -q – quiet
1432-
—— csearch – search for available completions from any plugin
1433-
—— cuninstall ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – uninstall completions for plugin
1434-
—— debug – manage debug mode
1435-
—— delete – delete a plugin or snippet
1436-
—— edit ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – edit plugin's file with \$EDITOR
1437-
—— env-whitelist [-v|-h] {env..} – allows to specify names (also patterns) of variables left unchanged during an unload. -v – verbose
1438-
—— glance ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – look at plugin's source (pygmentize, {,source-}highlight)
1439-
—— ice <ice specification> – add ICE to next command, argument is e.g. from\"gitlab\"
1440-
—— light [-b] ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – light plugin load, without reporting/tracking (-b – do track but bindkey-calls only)
1441-
—— load ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – load plugin, can also receive absolute local path
1442-
—— loaded|list {keyword} – show what plugins are loaded (filter with \'keyword')
1443-
—— ls – list snippets in formatted and colorized manner
1444-
—— man – manual
1445-
—— module – manage binary Zsh module shipped with Zinit, see \`zinit module help'
1446-
—— recall ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]}|URL – fetch saved ice modifiers and construct \`zinit ice ...' command
1447-
—— recently ${ZINIT[col-info]}[time-spec]${ZINIT[col-rst]} – show plugins that changed recently, argument is e.g. 1 month 2 days
1448-
—— report ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – show plugin's report (or all plugins' if ——all passed)
1449-
—— self-update – updates and compiles Zinit
1450-
—— snippet [-f] ${ZINIT[col-pname]}{url}${ZINIT[col-rst]} – source local or remote file (by direct URL), -f: force – don't use cache
1451-
—— srv {service-id} [cmd] – control a service, command can be: stop,start,restart,next,quit; \`next' moves the service to another Zshell
1452-
—— 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)
1453-
—— stress ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – test plugin for compatibility with set of options
1454-
—— 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
1455-
—— uncompile ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – remove compiled version of plugin (or of all plugins if ——all passed)
1456-
—— unload ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – unload plugin loaded with \`zinit load ...', -q – quiet
1457-
—— 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
1458-
—— version – display zinit version
1459-
—— zstatus – overall Zinit statu
1460-
—— add-fpath|fpath ${ZINIT[col-info]}[-f|--front]${ZINIT[col-rst]} \\
1461-
${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
1462-
—— 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"
1416+
print -- "Usage: zinit [OPTIONS] COMMAND"
1417+
print -- ""
1418+
print -- "Zinit is a plugin management system for zsh."
1419+
print -- ""
1420+
print -- "Commands:"
1421+
print -- " bindkeys Lists bindkeys set up by each plugin"
1422+
print -- " cd Change directory to a plugin or snippet"
1423+
print -- " cdclear Clear compdef replay list"
1424+
print -- " cdisable Disable completion"
1425+
print -- " cdlist Show compdef replay list"
1426+
print -- " cdreplay Replay compdefs"
1427+
print -- " cenable Enable completion"
1428+
print -- " changes View plugin's git log"
1429+
print -- " compile Compile plugin"
1430+
print -- " compiled List plugins that are compiled"
1431+
print -- " compinit Refresh installed completions"
1432+
print -- " completions List completions in use"
1433+
print -- " create Create plugin (also together with Github repository)"
1434+
print -- " creinstall Install a plugin or local completion"
1435+
print -- " csearch Search for available completions from any plugin"
1436+
print -- " cuninstall Uninstall completions for plugin"
1437+
print -- " debug Manage debug mode"
1438+
print -- " delete Delete a plugin or snippet"
1439+
print -- " edit Edit plugin's file with \$EDITOR"
1440+
print -- " glance Look at plugin's source"
1441+
print -- " help Usage information"
1442+
print -- " ice Add ICE to next command"
1443+
print -- " light Light plugin load, without reporting/tracking"
1444+
print -- " load Load plugin, can also receive absolute local path"
1445+
print -- " man Manual"
1446+
print -- " module Manage binary zsh module shipped with zinit"
1447+
print -- " plugins List currently installed plugins"
1448+
print -- " recall Fetch saved ice modifiers and construct "zinit ice ..." command"
1449+
print -- " recently Show plugins that changed recently"
1450+
print -- " report Show plugin's report"
1451+
print -- " self-update Update zinit"
1452+
print -- " snippet Source local or remote file (by direct URL)"
1453+
print -- " snippets List currently installed snippets"
1454+
print -- " status Git status for plugin or svn status for snippet"
1455+
print -- " stress Test plugin for compatibility with set of options"
1456+
print -- " times Statistics on plugin load times, sorted in order of loading"
1457+
print -- " uncompile Remove compiled version of plugin"
1458+
print -- " unload Unload plugin"
1459+
print -- " update Update a plugin or snippet"
1460+
print -- " version Display zinit version"
1461+
print -- " zstatus Overall zinit status"
14631462

14641463
integer idx
14651464
local type key
@@ -1474,9 +1473,9 @@ EOF
14741473
done
14751474
done
14761475

1477-
local -a ice_order
1478-
ice_order=( ${${(s.|.)ZINIT[ice-list]}:#teleid} ${(@)${(@)${(@Akons:|:u)${ZINIT_EXTS[ice-mods]//\'\'/}}/(#s)<->-/}:#(.*|dynamic-unscope)} )
1479-
print -- "\nAvailable ice-modifiers:\n\n${ice_order[*]}"
1476+
print -- "Run 'zinit COMMAND --help' for more information on a command."
1477+
print -- ''
1478+
print -- "For more help on how to use Zinit, head to https://github.com/zdharma_continuum/zinit'."
14801479
} # ]]]
14811480

14821481
# FUNCTION: .zinit-list-bindkeys [[[

zinit-install.zsh

+1-6
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,7 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
1212
# that's not the case
1313
.zinit-jq-check() {
1414
command -v jq >/dev/null && return 0
15-
16-
+zinit-message "{error}❌ ERROR: jq binary not found" \
17-
"{nl}{u-warn}Please install jq:{rst}" \
18-
"https://github.com/jqlang/jq" \
19-
"{nl}{u-warn}To do so with zinit, please refer to:{rst}" \
20-
"https://github.com/zdharma-continuum/zinit/wiki/%F0%9F%A7%8A-Recommended-ices#jq"
15+
+zi-log '{e} Missing required dependency {cmd}jq{rst}. Please install it.'
2116
return 1
2217
} # ]]]
2318
# FUNCTION: .zinit-json-get-value [[[

0 commit comments

Comments
 (0)