Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Oddity when completing option arguments after command arguments
- X-seq: zsh-workers 42141
- From: Marko Myllynen <myllynen@xxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Oddity when completing option arguments after command arguments
- Date: Mon, 18 Dec 2017 14:01:11 +0200
- 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
- Organization: Red Hat
- Reply-to: Marko Myllynen <myllynen@xxxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author