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

Re: Completing comma seprated list of option values in _atguments

On Пнд, 2002-02-25 at 11:54, Sven Wischnowsky wrote:
> Borsenkow Andrej wrote:
> > I must be entirely stupid but I cannot figure out how to do it. Values
> > must be generated on the fly not chosen from fixed array. And _values
> > seems to want fixed values only :(
> Yes, _values is not intended for that, although it depends on how the
> values are generated, of course...
> We probably don't need utility functions for everything, simple
> solution, not that nice, but ok when values may appear more than once:

I finally ended up with

_urpmi_media() {
    local source media brace ret=1 opt
    local -a all_sources
    local context state line
    typeset -A val_args
    while read source media brace; do
        [[ "$brace" != "{" ]] && continue
        all_sources=($all_sources $source)
    done < /etc/urpmi/urpmi.cfg
    if [[ "$service" == urpmq ]]; then
        _values -s , "urpmi media"  "$all_sources[@]" && ret=0
        _wanted urpmi_media expl 'available media' \
            compadd "$@" -a -- all_sources && ret=0
    return ret

but may be I can omit _values just as well, besides it seems to be buggy
at this point.



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