From: Pavol Juhas <pavol.juhas@gmail.com>
To: zsh-workers@zsh.org
Subject: bug-or-feature - different completion context after "--option VALUE" vs "--option=VALUE"
Date: Wed, 20 Jul 2022 21:18:12 -0700 [thread overview]
Message-ID: <CAA44gkXbxotDR2CaEoEOciheuEN487c_JrdFipG1uixEWt-_7w@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1564 bytes --]
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):
$ mycmd --name Alice _
tags in context :completion::complete:mycmd::
name-argument-1 (_arguments _mycmd)
versus
$ 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
work?
Thank you,
Pavol
[-- Attachment #2: Type: text/html, Size: 11127 bytes --]
next reply other threads:[~2022-07-21 4:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-21 4:18 Pavol Juhas [this message]
2022-07-21 22:34 ` Bart Schaefer
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=CAA44gkXbxotDR2CaEoEOciheuEN487c_JrdFipG1uixEWt-_7w@mail.gmail.com \
--to=pavol.juhas@gmail.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).