#compdef spellout

autoload -U is-at-least

_spellout() {
    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+[Specify the phonetic code for encoding/decoding the input text. Default is NATO. Use \`--list\` option to see all available codes.]:CODE:((chp\:"California Highway Patrol Phonetic Alphabet"
english\:""
eu\:""
france\:""
indonesia\:""
international\:""
italia\:""
nato\:"\[NATO Phonetic Alphabet, Code, & Signals\](https\://www.nato.int/content/dam/nato/webready/news/2010-2019/2017/12/21/20180111_nato-alphabet-sign-signal.pdf)"
netherlands\:""
philippines\:""
sweden\:""
uk\:""
usa-airpots\:""
japanese\:""))' \
'--code=[Specify the phonetic code for encoding/decoding the input text. Default is NATO. Use \`--list\` option to see all available codes.]:CODE:((chp\:"California Highway Patrol Phonetic Alphabet"
english\:""
eu\:""
france\:""
indonesia\:""
international\:""
italia\:""
nato\:"\[NATO Phonetic Alphabet, Code, & Signals\](https\://www.nato.int/content/dam/nato/webready/news/2010-2019/2017/12/21/20180111_nato-alphabet-sign-signal.pdf)"
netherlands\:""
philippines\:""
sweden\:""
uk\:""
usa-airpots\:""
japanese\:""))' \
'--input=[Specify the the path to a custom phonetic code file.]:FILE:_files' \
'-l[Prints the available phonetic codes.]' \
'--list[Prints the available phonetic codes.]' \
'-p[Prints the phonetic codes for the given type.]' \
'--print[Prints the phonetic codes for the given type.]' \
'--only-code[Prints the only phonetic code for the given words.]' \
'-d[Decodes given phonetic codes into string.]' \
'--decode[Decodes given phonetic codes into string.]' \
'--gencomp[Generates completion files.]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
'*::args -- The words to encode using the specified phonetic code.
Gives '\''-'\'' read from stdin. No arguments also reads from stdin.:_default' \
&& ret=0
}

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

if [ "$funcstack[1]" = "_spellout" ]; then
    _spellout "$@"
else
    compdef _spellout spellout
fi
