zsh-users
 help / color / mirror / code / Atom feed
From: "Alexey I. Froloff" <raorn@altlinux.org>
To: zsh-users@zsh.org
Subject: Q: _regex_arguments problem
Date: Fri, 2 Dec 2011 17:14:18 +0400	[thread overview]
Message-ID: <20111202131418.GA18623@altlinux.org> (raw)

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

Hi!

A have complex completion written on top or
_regex_words/_regex_arguments functions.  This looks like:

===8<===
#compdef fubar

_fubar_variants()
{
    local -a variants

    variants=( 'one' 'two' 'three' 'four' )
    _describe -t vatiant-id 'variant id' variants -V variants
}

local -a args reply
args=(
    # Command word.  Don't care what that is.
    /$'[^\0]#\0'/
)

local -a variant_any_id_arg
variant_any_id_arg=(
  /$'[^\0]##\0'/ ':variant-id:variant id:_fubar_variants'
)

local -a opt_args
_regex_words \
  fubar-options "fubar options" \
  '--variants:variants list:$variant_any_id_arg'
args+=(
  '(' "$reply[@]" '|' ')'
)

_regex_arguments _fubar "${args[@]}"

_fubar "$@"
===>8===

I want to complete --variants option argument as a
comma-separated list of variants, like

fubar --variants one,two,four

The only example of _regex_words/_regex_arguments usage is ip(8)
completion, but it doesn't use such syntax.

Is it possible at all?  _fubar_variants function is also used
where exactly one variant is required, so I'd rather not to
change it.

P.S. I'm not offering this completion to main tree because this
is a completion for special service only used in ALT Linux -
http://en.altlinux.org/Git.alt_reference

I uses complex context-based syntax (just like ip(8)!), so I
decided to use _regex_words/_regex_arguments.

-- 
Regards,    --
Sir Raorn.   --- http://thousandsofhate.blogspot.com/

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

             reply	other threads:[~2011-12-02 13:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-02 13:14 Alexey I. Froloff [this message]
2011-12-02 15:45 ` Bart Schaefer
2011-12-02 16:15 ` Peter Stephenson
2011-12-02 17:37   ` Alexey I. Froloff
2011-12-02 18:14     ` Bart Schaefer
2011-12-02 20:25       ` 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=20111202131418.GA18623@altlinux.org \
    --to=raorn@altlinux.org \
    --cc=zsh-users@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).