#compdef pinky

autoload -U is-at-least

_pinky() {
    typeset -A opt_args
    typeset -a _arguments_options
    local ret=1

    if is-at-least 5.2; then
        _arguments_options=(-s -S -C)
    else
        _arguments_options=(-s -C)
    fi

    local context curcontext="$curcontext" state line
    _arguments "${_arguments_options[@]}" : \
'-l[pinky-help-long-format]' \
'-b[pinky-help-omit-home-dir]' \
'-h[pinky-help-omit-project-file]' \
'-p[pinky-help-omit-plan-file]' \
'-s[pinky-help-short-format]' \
'-f[pinky-help-omit-headings]' \
'-w[pinky-help-omit-name]' \
'-i[pinky-help-omit-name-host]' \
'-q[pinky-help-omit-name-host-time]' \
'--help[pinky-help-help]' \
'-V[Print version]' \
'--version[Print version]' \
'::user:_users' \
&& ret=0
}

(( $+functions[_pinky_commands] )) ||
_pinky_commands() {
    local commands; commands=()
    _describe -t commands 'pinky commands' commands "$@"
}

if [ "$funcstack[1]" = "_pinky" ]; then
    _pinky "$@"
else
    compdef _pinky pinky
fi
