zsh-users
 help / color / mirror / code / Atom feed
* Q: _regex_arguments problem
@ 2011-12-02 13:14 Alexey I. Froloff
  2011-12-02 15:45 ` Bart Schaefer
  2011-12-02 16:15 ` Peter Stephenson
  0 siblings, 2 replies; 6+ messages in thread
From: Alexey I. Froloff @ 2011-12-02 13:14 UTC (permalink / raw)
  To: zsh-users

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

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

end of thread, other threads:[~2011-12-02 20:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-02 13:14 Q: _regex_arguments problem Alexey I. Froloff
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

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