Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Q: _regex_arguments problem



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: signature.asc
Description: Digital signature



Messages sorted by: Reverse Date, Date, Thread, Author