help / color / mirror / code / Atom feed
* bug-or-feature - different completion context after "--option VALUE" vs "--option=VALUE"
@ 2022-07-21  4:18 Pavol Juhas
  2022-07-21 22:34 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Pavol Juhas @ 2022-07-21  4:18 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1564 bytes --]


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
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

$ mycmd --name Alice _

tags in context :completion::complete:mycmd::

    name-argument-1  (_arguments _mycmd)


$ mycmd --name=Alice _

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

Thank you,


[-- Attachment #2: Type: text/html, Size: 11127 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-21 22:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-21  4:18 bug-or-feature - different completion context after "--option VALUE" vs "--option=VALUE" Pavol Juhas
2022-07-21 22:34 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox


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).