Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 2/5] _hg: declare appropriate local parameters for ->string form
- X-seq: zsh-workers 43237
- From: Anton Shestakov <av6@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH 2/5] _hg: declare appropriate local parameters for ->string form
- Date: Mon, 6 Aug 2018 15:28:10 +0800
- Cc: Anton Shestakov <av6@xxxxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dwimlabs.net; s=20171204; t=1533540507; bh=RmzXvuUs8/40pcLHoc/JgKPGqfhrpZBDTj6ebGCNlHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KpGT47AtLFzVAhnXptjC+/J5Y7jTQSA5yrOQ/rwdUKxvKlDchjEPh1wmxq4ptmuDv fWwV3OL9f375WtsmXEleeH3IEkC1oNFIZsYR9jSgIj4WQxPLRQO16tJ0pHscRwQxMB CLzaZguczsTnCIc2XGtKJk+uITa1VyUx53Owt7cw=
- In-reply-to: <20180806072813.5051-1-av6@dwimlabs.net>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20180806072813.5051-1-av6@dwimlabs.net>
http://zsh.sourceforge.net/Doc/Release/Completion-System.html says that
when ->string form is used for _arguments, the function that calls it
must declare appropriate local parameters.
&& ret=0 is also needed (not sure why, the help page doesn't explain
it), otherwise completing `hg diff -<TAB>` doesn't look right.
---
Completion/Unix/Command/_hg | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/Completion/Unix/Command/_hg b/Completion/Unix/Command/_hg
index 50ab7132c..693e0c4bd 100644
--- a/Completion/Unix/Command/_hg
+++ b/Completion/Unix/Command/_hg
@@ -523,14 +523,16 @@ _hg_cmd_copy() {
}
_hg_cmd_diff() {
+ local context state state_descr line
typeset -A opt_args
+
_arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
'*'{-r+,--rev=}'[revision]:revision:_hg_revrange' \
'(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \
'(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \
'(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \
'(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \
- '*:file:->diff_files'
+ '*:file:->diff_files' && ret=0
if [[ $state == 'diff_files' ]]
then
@@ -698,14 +700,14 @@ _hg_cmd_rename() {
}
_hg_cmd_resolve() {
- local context state line
+ local context state state_descr line
typeset -A opt_args
_arguments -s : $_hg_global_opts \
'(--list -l --mark -m --unmark -u)'{-l,--list}'[list state of files needing merge]:*:merged files:->resolve_files' \
'(--mark -m --list -l --unmark -u)'{-m,--mark}'[mark files as resolved]:*:unresolved files:_hg_unresolved' \
'(--unmark -u --list -l --mark -m)'{-u,--unmark}'[unmark files as resolved]:*:resolved files:_hg_resolved' \
- '*:file:_hg_unresolved'
+ '*:file:_hg_unresolved' && ret=0
if [[ $state == 'resolve_files' ]]
then
@@ -715,14 +717,14 @@ _hg_cmd_resolve() {
}
_hg_cmd_revert() {
- local context state line
+ local context state state_descr line
typeset -A opt_args
_arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
'(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \
'(--rev -r)'{-r+,--rev=}'[revision to revert to]:revision:_hg_tags' \
'--no-backup[do not save backup copies of files]' \
- '*:file:->diff_files'
+ '*:file:->diff_files' && ret=0
if [[ $state == 'diff_files' ]]
then
--
2.11.0
Messages sorted by:
Reverse Date,
Date,
Thread,
Author