Hello,
I am trying to write a completion function for my custom command,
which should offer different suggestions for positional arguments
after a long option with mandatory value. I have a code which works as desired
when the option is given in "--option VALUE" format, but not if specified
as "--option=VALUE". In the latter case the completion
is the same as without any option.
Here is a reduced minimum example for a command "mycmd"
(for testing purpose mycmd can be a symlink to /bin/true):
# _mycmd ---------------------------------------------------------------------
#compdef mycmd
_arguments : \
- name \
'--name=[name of a person]:person-name:()' \
'1:letters:(a b c)' \
- without-name \
'*:digits:(1 2 3)' \
;
# ----------------------------------------------------------------------------
The desired behavior is that command lines starting as either
"mycmd --name Alice " and "mycmd --name=Alice "
should offer argument suggestions a, b, c,
however the version with the equal sign completes 1, 2, 3,
as if completing without the --name option.
The completion context appears to be incorrect in that case (_ marks cursor position):
tags in context :completion::complete:mycmd::
name-argument-1 (_arguments _mycmd)
versus
tags in context :completion::complete:mycmd::
without-name-argument-rest (_arguments _mycmd)
Is this a bug or feature?
If feature, am I perhaps missing some special specification flag to make it work?
Thank you,
Pavol