#compdef powernotd

autoload -U is-at-least

_powernotd() {
    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[@]}" : \
'-f+[Set config-file path if needed, otherwise \$XDG_CONFIG_HOME/powernotd/config.json is used]:CONFIG_FILE: ' \
'--config-file=[Set config-file path if needed, otherwise \$XDG_CONFIG_HOME/powernotd/config.json is used]:CONFIG_FILE: ' \
'-b+[Pass the battery such as '\''BAT1'\'' if your system has multiple and you do not want to use the default (BAT0). Check '\''/sys/class/power_supply/'\'' to see which batteries you have]:BATTERY: ' \
'--battery=[Pass the battery such as '\''BAT1'\'' if your system has multiple and you do not want to use the default (BAT0). Check '\''/sys/class/power_supply/'\'' to see which batteries you have]:BATTERY: ' \
'-s[Print the current battery-level to stdout then exit]' \
'--status-level[Print the current battery-level to stdout then exit]' \
'-c[Print charging status '\''charging'\'', '\''discharging'\'', '\''full'\'' or '\''unknown'\'' to stdout then exit]' \
'--charging-state[Print charging status '\''charging'\'', '\''discharging'\'', '\''full'\'' or '\''unknown'\'' to stdout then exit]' \
'-n[Send desktop notification with current battery-level then exit]' \
'--notify-now[Send desktop notification with current battery-level then exit]' \
'-t[List all notification thresholds in the format '\''a_1%, a_2%, ..., a_n%'\'' that are specified in the config-file]' \
'--list-thresholds[List all notification thresholds in the format '\''a_1%, a_2%, ..., a_n%'\'' that are specified in the config-file]' \
'-p[Display the path to the config-file]' \
'--show-config-path[Display the path to the config-file]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
&& ret=0
}

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

if [ "$funcstack[1]" = "_powernotd" ]; then
    _powernotd "$@"
else
    compdef _powernotd powernotd
fi
