#compdef shotman

autoload -U is-at-least

_shotman() {
    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[@]}" \
'-c+[Capture the given target into a screenshot]:TARGET:((window\:"The currently active window"
output\:"The entirety of the currently active output"
region\:"A custom region (chosen interactively)"))' \
'--capture=[Capture the given target into a screenshot]:TARGET:((window\:"The currently active window"
output\:"The entirety of the currently active output"
region\:"A custom region (chosen interactively)"))' \
'-i+[Use \`PROG\` as an image editor]:PROG: ' \
'--image-editor=[Use \`PROG\` as an image editor]:PROG: ' \
'-v+[Log using specified verbosity]:VERBOSE: ' \
'--verbose=[Log using specified verbosity]:VERBOSE: ' \
'-a+[Anchor thumbnail to this edge of the screen]:ANCHOR: ' \
'--anchor=[Anchor thumbnail to this edge of the screen]:ANCHOR: ' \
'-C[Automatically copy to clipboard]' \
'--copy[Automatically copy to clipboard]' \
'--unstable-copy-as-uri[When copying to clipboard, also offer mime type \`text/uri-list\`]' \
'-p[Print path to screenshots directory and exit]' \
'--print-dir[Print path to screenshots directory and exit]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
&& ret=0
}

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

if [ "$funcstack[1]" = "_shotman" ]; then
    _shotman "$@"
else
    compdef _shotman shotman
fi
