#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: ' \
'--preset=[Sets the name of the sound preset to use]:PRESET: ' \
'-c+[Sets the configuration file]:PATH:_files' \
'--config=[Sets the configuration file]:PATH:_files' \
'-v[Enables verbose logging]' \
'--verbose[Enables verbose logging]' \
'-l[Lists the available presets]' \
'--list[Lists the available presets]' \
'-i[Writes the default configuration file]' \
'--init[Writes the default configuration file]' \
'-h[Print help]' \
'--help[Print 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
