From: Marko Myllynen <myllynen@redhat.com>
To: zsh-workers@zsh.org
Subject: Oddity when completing option arguments after command arguments
Date: Mon, 18 Dec 2017 14:01:11 +0200 [thread overview]
Message-ID: <aa06fe49-e2e9-df25-14f0-3f6afe3cb56b@redhat.com> (raw)
Hi,
While working on some Zsh completions I happened to notice the following
when using this kind of completion (extracted ~minimal example follows):
#compdef foo
_foo () {
local curcontext="$curcontext" state line expl ret=1
declare -A opt_args
case $service in
foo)
_arguments -C -S -s \
"(- *)"{-h,--help}'[show help]' \
"(-h --help)"\*{-F+,--filename}'[specify filename]:file:_files' \
'*:host:_hosts' \
&& return 0
;;
esac
return ret
}
_foo "$@"
These work as expected:
$ foo -F <TAB> - getting filenames
$ foo -F<TAB> - getting filenames
$ foo <TAB> - getting hostnames
$ foo localhost --filename <TAB> - getting filenames
$ foo localhost -F<TAB> - getting filenames
But here's the unexpected case:
$ foo localhost -F <TAB> - getting filenames and hostnames
This is with 5.4.1. What could explain this behavior, any suggestions
how to fix this (so that in the last case would get only filenames)?
Thanks,
--
Marko Myllynen
next reply other threads:[~2017-12-18 12:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-18 12:01 Marko Myllynen [this message]
2017-12-20 4:52 ` dana
2017-12-20 9:08 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aa06fe49-e2e9-df25-14f0-3f6afe3cb56b@redhat.com \
--to=myllynen@redhat.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).