#compdef daktilo

autoload -U is-at-least

_daktilo() {
    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[@]}" \
'*-p+[Sets the name of the sound preset to use]' \
'*--preset=[Sets the name of the sound preset to use]' \
'-d+[Sets the device for playback]:DEVICE: ' \
'--device=[Sets the device for playback]:DEVICE: ' \
'-c+[Sets the configuration file]:PATH:_files' \
'--config=[Sets the configuration file]:PATH:_files' \
'*--variate-volume=[Variate volume +/- in percent]:PERCENT_UP[,PERCENT_DOWN]: ' \
'*--variate-tempo=[Variate tempo +/- in percent]:PERCENT_UP[,PERCENT_DOWN]: ' \
'-v[Enables verbose logging]' \
'--verbose[Enables verbose logging]' \
'-l[Lists the available presets]' \
'--list-presets[Lists the available presets]' \
'--list-devices[Lists the available output devices]' \
'-i[Writes the default configuration file]' \
'--init[Writes the default configuration file]' \
'--no-surprises[Disables the easter eggs]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
&& ret=0
}

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

if [ "$funcstack[1]" = "_daktilo" ]; then
    _daktilo "$@"
else
    compdef _daktilo daktilo
fi
