#compdef wleave

autoload -U is-at-least

_wleave() {
    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[@]}" : \
'-s+[Run the application in service mode - it will stay in the background until triggered]' \
'--service=[Run the application in service mode - it will stay in the background until triggered]' \
'-l+[Specify a layout file, specifying - will read the layout config from stdin]:LAYOUT:_files' \
'--layout=[Specify a layout file, specifying - will read the layout config from stdin]:LAYOUT:_files' \
'--button-layout=[Specify the way the buttons should be laid out in the available space]:BUTTON_LAYOUT:(grid)' \
'-C+[Specify a custom CSS file]:CSS:_files' \
'--css=[Specify a custom CSS file]:CSS:_files' \
'-b+[Set the number of buttons per row, or use a fraction to specify the number of rows to be used (e.g. "1/1" for all buttons in a single row, "1/5" to distribute the buttons over 5 rows)]:BUTTONS_PER_ROW:_default' \
'--buttons-per-row=[Set the number of buttons per row, or use a fraction to specify the number of rows to be used (e.g. "1/1" for all buttons in a single row, "1/5" to distribute the buttons over 5 rows)]:BUTTONS_PER_ROW:_default' \
'-c+[Set space between buttons columns]:COLUMN_SPACING:_default' \
'--column-spacing=[Set space between buttons columns]:COLUMN_SPACING:_default' \
'-r+[Set space between buttons rows]:ROW_SPACING:_default' \
'--row-spacing=[Set space between buttons rows]:ROW_SPACING:_default' \
'-m+[Set the margin around buttons]:MARGIN:_default' \
'--margin=[Set the margin around buttons]:MARGIN:_default' \
'-L+[Set margin for the left of buttons]:MARGIN_LEFT:_default' \
'--margin-left=[Set margin for the left of buttons]:MARGIN_LEFT:_default' \
'-R+[Set margin for the right of buttons]:MARGIN_RIGHT:_default' \
'--margin-right=[Set margin for the right of buttons]:MARGIN_RIGHT:_default' \
'-T+[Set margin for the top of buttons]:MARGIN_TOP:_default' \
'--margin-top=[Set margin for the top of buttons]:MARGIN_TOP:_default' \
'-B+[Set the margin for the bottom of buttons]:MARGIN_BOTTOM:_default' \
'--margin-bottom=[Set the margin for the bottom of buttons]:MARGIN_BOTTOM:_default' \
'-A+[Set the aspect ratio of the buttons]:BUTTON_ASPECT_RATIO:_default' \
'--button-aspect-ratio=[Set the aspect ratio of the buttons]:BUTTON_ASPECT_RATIO:_default' \
'-d+[The delay (in milliseconds) between the window closing and executing the selected option]:DELAY_COMMAND_MS:_default' \
'--delay-command-ms=[The delay (in milliseconds) between the window closing and executing the selected option]:DELAY_COMMAND_MS:_default' \
'-f+[Close the menu on lost focus]' \
'--close-on-lost-focus=[Close the menu on lost focus]' \
'-k+[Show the associated key binds]' \
'--show-keybinds=[Show the associated key binds]' \
'-p+[Use layer-shell or xdg protocol]:PROTOCOL:(layer-shell none xdg)' \
'--protocol=[Use layer-shell or xdg protocol]:PROTOCOL:(layer-shell none xdg)' \
'-x+[Hide version information]' \
'--no-version-info=[Hide version information]' \
'-v[]' \
'--version[]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
}

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

if [ "$funcstack[1]" = "_wleave" ]; then
    _wleave "$@"
else
    compdef _wleave wleave
fi
