#compdef satty

autoload -U is-at-least

_satty() {
    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+[Path to the config file. Otherwise will be read from XDG_CONFIG_DIR/satty/config.toml]:CONFIG:_default' \
'--config=[Path to the config file. Otherwise will be read from XDG_CONFIG_DIR/satty/config.toml]:CONFIG:_default' \
'-f+[Path to input image or '\''-'\'' to read from stdin]:FILENAME:_default' \
'--filename=[Path to input image or '\''-'\'' to read from stdin]:FILENAME:_default' \
'-o+[Filename to use for saving action or '\''-'\'' to print to stdout. Omit to disable saving to file. Might contain format specifiers\: <https\://docs.rs/chrono/latest/chrono/format/strftime/index.html>]:OUTPUT_FILENAME:_default' \
'--output-filename=[Filename to use for saving action or '\''-'\'' to print to stdout. Omit to disable saving to file. Might contain format specifiers\: <https\://docs.rs/chrono/latest/chrono/format/strftime/index.html>]:OUTPUT_FILENAME:_default' \
'--corner-roundness=[Draw corners of rectangles round if the value is greater than 0 (Defaults to 12) (0 disables rounded corners)]:CORNER_ROUNDNESS:_default' \
'--initial-tool=[Select the tool on startup]:TOOL:(pointer crop line arrow rectangle ellipse text marker blur highlight brush)' \
'--init-tool=[Select the tool on startup]:TOOL:(pointer crop line arrow rectangle ellipse text marker blur highlight brush)' \
'--copy-command=[Configure the command to be called on copy, for example \`wl-copy\`]:COPY_COMMAND:_default' \
'--annotation-size-factor=[Increase or decrease the size of the annotations]:ANNOTATION_SIZE_FACTOR:_default' \
'*--actions-on-enter=[Actions to perform when pressing Enter]:ACTIONS_ON_ENTER:(save-to-clipboard save-to-file exit)' \
'*--actions-on-escape=[Actions to perform when pressing Escape]:ACTIONS_ON_ESCAPE:(save-to-clipboard save-to-file exit)' \
'*--actions-on-right-click=[Actions to perform when hitting the copy Button]:ACTIONS_ON_RIGHT_CLICK:(save-to-clipboard save-to-file exit)' \
'--font-family=[Font family to use for text annotations]:FONT_FAMILY:_default' \
'--font-style=[Font style to use for text annotations]:FONT_STYLE:_default' \
'--primary-highlighter=[The primary highlighter to use, secondary is accessible with CTRL]:PRIMARY_HIGHLIGHTER:(block freehand)' \
'--brush-smooth-history-size=[Experimental feature\: How many points to use for the brush smoothing algorithm. 0 disables smoothing. The default value is 0 (disabled)]:BRUSH_SMOOTH_HISTORY_SIZE:_default' \
'--action-on-enter=[Action to perform when pressing Enter. Preferably use the \`actions_on_enter\` option instead]:ACTION_ON_ENTER:(save-to-clipboard save-to-file exit)' \
'--fullscreen[Start Satty in fullscreen mode]' \
'--early-exit[Exit directly after copy/save action]' \
'--save-after-copy[After copying the screenshot, save it to a file as well Preferably use the \`action_on_copy\` option instead]' \
'-d[Hide toolbars by default]' \
'--default-hide-toolbars[Hide toolbars by default]' \
'--focus-toggles-toolbars[Experimental\: Whether to toggle toolbars based on focus. Doesn'\''t affect initial state]' \
'--default-fill-shapes[Experimental feature\: Fill shapes by default]' \
'--disable-notifications[Disable notifications]' \
'--profile-startup[Print profiling]' \
'--no-window-decoration[Disable the window decoration (title bar, borders, etc.) Please note that the compositor has the final say in this. Requires xdg-decoration-unstable-v1]' \
'--right-click-copy[Right click to copy. Preferably use the \`action_on_right_click\` option instead]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
&& ret=0
}

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

if [ "$funcstack[1]" = "_satty" ]; then
    _satty "$@"
else
    compdef _satty satty
fi
