* _arguments -C … && ret=0 or _arguments -C … && return 0
@ 2011-07-21 13:57 Nikolai Weibull
2011-07-21 14:59 ` _arguments -C ... && ret=0 or _arguments -C ... && r eturn 0 Bart Schaefer
0 siblings, 1 reply; 2+ messages in thread
From: Nikolai Weibull @ 2011-07-21 13:57 UTC (permalink / raw)
To: Zsh Workers
Hi!
What’s the preferred way of dealing with _arguments calls that may use actions?
Etc/completion-style-guide suggests using _arguments -C … && return 0,
but many completion definitions use _arguments -C … && ret=0.
For example, Completion/Unix/Command/_bzip2 uses the_arguments -C … &&
ret=0 style. This leads to files matching -* being included as
completions. Is this desired behavior, or is it simply a bug?
Current behavior:
% touch ./--hello
% bzip2 --h^I
[option]
--help display help message
[file to compress]
--hello
For most commands, completing a file name that looks like an option
will result in an error, so my gut feeling is that we should return
instead of looking for the additional possible completions.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: _arguments -C ... && ret=0 or _arguments -C ... && r eturn 0
2011-07-21 13:57 _arguments -C … && ret=0 or _arguments -C … && return 0 Nikolai Weibull
@ 2011-07-21 14:59 ` Bart Schaefer
0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2011-07-21 14:59 UTC (permalink / raw)
To: Zsh Workers
On Jul 21, 3:57pm, Nikolai Weibull wrote:
}
} Etc/completion-style-guide suggests using _arguments -C ... && return 0,
} but many completion definitions use _arguments -C ... && ret=0.
}
} For example, Completion/Unix/Command/_bzip2 uses the_arguments -C ... &&
} ret=0 style. This leads to files matching -* being included as
} completions. Is this desired behavior, or is it simply a bug?
Assuming that ultimately there's eventually a "return ret" then as far
as the caller of the completion function is concerned there's not going
to be any difference.
So whether it's a bug is going to be specific to each function, based
on what else that function does after assigning ret=0. Handling of
->state forms comes to mind.
} For most commands, completing a file name that looks like an option
} will result in an error, so my gut feeling is that we should return
} instead of looking for the additional possible completions.
What if there's a matcher spec that might complete "-b" into "foo-bar"?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-07-21 14:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-21 13:57 _arguments -C … && ret=0 or _arguments -C … && return 0 Nikolai Weibull
2011-07-21 14:59 ` _arguments -C ... && ret=0 or _arguments -C ... && r eturn 0 Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).