# demo zsh completion script generated by CLIFramework
# Web: http://github.com/c9s/php-CLIFramework
# THIS IS AN AUTO-GENERATED FILE, PLEASE DON'T MODIFY THIS FILE DIRECTLY.

(( $+functions[__foo_meta] )) ||
__foo_meta () {
    local curcontext=$curcontext state line ret=1
    declare -A opt_args
    local ret=1
    declare -a values

    desc=$1
    cmd=$2
    valtype=$3
    pos=$4
    completion=$5

    # $1 = -M, $2 = m:{[:lower:][:upper:]}={[:upper:][:lower:]}, $3 = -J, $4= option--author-1
    echo "example/demo _meta $4"
    # values=$(example/demo _meta $cmd $valtype $pos $completion)
    values=($(example/demo _meta commit $valtype $pos $completion))

    # =values to expand values
    _values $desc ${=values} && ret=0
    # _arguments $desc ${=values} && ret=0
    return ret
}

# (( $+functions[__foo_commit] )) ||
__foo_commit () {
    local curcontext=$curcontext state line ret=1
    declare -A opt_args
    declare -a lines
    local ret=1
    lines=("#values" "c7a559c" "f135f61" "2f662" "572e9a7a31cb03e9caa97")

    lines=(
        '#descriptions'
        aaa:'aaa'
        bbb:'bbb'
        ccc:'ccc'
        ddd:'ddd'
        eee:'eee'
    )

    if [[ $lines[1] == "#values" ]] ; then
        declare -a commits
        commits=(${lines:1})
         _values "commits" ${=commits} && ret=0
    elif [[ $lines[1] == "#descriptions" ]] ; then
        declare -a commits
        commits=(${lines:1})
        # _describe -t commits commit commits && ret=0
        _describe commit commits && ret=0
    fi
    return ret
}

_foo () {
    local curcontext=$curcontext state line
    # typeset -A opt_args
    typeset -A val_args
    # typeset -A values
    declare -A opt_args
    local ret=1
    _arguments -w -C -S -s \
        '--author=[Override the commit author. Specify an explicit author using the standard A U Thor <author@example.com> format.]:author name:{__foo_meta dddd commit arg 1 valid-values}' \
        '--commit=[commit with description]:commit:{ __foo_commit }' \
        '--test=[commit with description]:test:(("foo\:foo desc" "bar\:bar desc"))' \
        && ret=0
    return ret
}
compdef _foo foo
