#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[produce long format output for the specified USERs]' \
'-b[omit the user'\''s home directory and shell in long format]' \
'-h[omit the user'\''s project file in long format]' \
'-p[omit the user'\''s plan file in long format]' \
'-s[do short format output, this is the default]' \
'-f[omit the line of column headings in short format]' \
'-w[omit the user'\''s full name in short format]' \
'-i[omit the user'\''s full name and remote host in short format]' \
'-q[omit the user'\''s full name, remote host and idle time in short format]' \
'--lookup[attempt to canonicalize hostnames via DNS]' \
'--help[Print help information]' \
'-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
