From f5e58a5ca723b2fb71fac87699cfabc662560405 Mon Sep 17 00:00:00 2001 From: fishBone000 Date: Wed, 18 Sep 2024 04:12:15 +0000 Subject: [PATCH] Finish Tips --- zsh-completions-howto.zh.org | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/zsh-completions-howto.zh.org b/zsh-completions-howto.zh.org index 8f9950f..d676e00 100644 --- a/zsh-completions-howto.zh.org +++ b/zsh-completions-howto.zh.org @@ -432,11 +432,10 @@ _arguments、_alternative、_regex_arguments等的定义处要在正确的地方 使用_regex_arguments时要记得在开头写匹配命令的模式(不需要加入匹配动作(action))。 记得在_regex_arguments的任何PATTERN(模式)参数后加上null字符$'\0' -* Tips -Sometimes you have a situation where there is just one option that can come after a subcommand, and zsh will complete this -automatically when tab is pressed after the subcommand. If instead you want it listed with its description before completing -you can add another empty option (i.e. \:) to the ACTION like this ':TAG:DESCRIPTION:((opt1\:"description for opt1" \:))' -Note this only applies to utility functions that use ACTIONs in their specification arguments (_arguments, _regex_arguments, etc.) +* 小贴士 +有时一个子命令后只会跟一个选项,这时zsh会在tab在子命令后按下时自动补全。如果你想要在补全前先列出选项和描述, +你可以向ACTION(动作)加入另一个空选项(比如\:),如':TAG:DESCRIPTION:((opt1\:"opt1描述" \:))' +注意这只对在定义参数中使用ACTION的工具函数(_arguments、_regex_arguments等)有效。 * Other resources [[https://wikimatze.de/writing-zsh-completion-for-padrino/][Here]] is a nicely formatted short tutorial showing basic usage of the _arguments function,