#compdef raw

autoload -U is-at-least

_raw() {
    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[@]}" : \
'-t+[Target tarball file to extract and decompress. Supports globbing.]:TARGET:_files' \
'--target=[Target tarball file to extract and decompress. Supports globbing.]:TARGET:_files' \
'-d+[Output directory of extracted archive.]:OUTDIR:_files' \
'--outdir=[Output directory of extracted archive.]:OUTDIR:_files' \
'-S+[Whether to silence the output or not.]:SILENT:(true false)' \
'--silent=[Whether to silence the output or not.]:SILENT:(true false)' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_raw_commands" \
"*::: :->raw" \
&& ret=0
    case $state in
    (raw)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:raw-command-$line[1]:"
        case $line[1] in
            (generate-completions-for)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
':shell:(bash elvish fish powershell zsh)' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_raw__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:raw-help-command-$line[1]:"
        case $line[1] in
            (generate-completions-for)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_raw_commands] )) ||
_raw_commands() {
    local commands; commands=(
'generate-completions-for:Generate shell completions' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'raw commands' commands "$@"
}
(( $+functions[_raw__generate-completions-for_commands] )) ||
_raw__generate-completions-for_commands() {
    local commands; commands=()
    _describe -t commands 'raw generate-completions-for commands' commands "$@"
}
(( $+functions[_raw__help_commands] )) ||
_raw__help_commands() {
    local commands; commands=(
'generate-completions-for:Generate shell completions' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'raw help commands' commands "$@"
}
(( $+functions[_raw__help__generate-completions-for_commands] )) ||
_raw__help__generate-completions-for_commands() {
    local commands; commands=()
    _describe -t commands 'raw help generate-completions-for commands' commands "$@"
}
(( $+functions[_raw__help__help_commands] )) ||
_raw__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'raw help help commands' commands "$@"
}

if [ "$funcstack[1]" = "_raw" ]; then
    _raw "$@"
else
    compdef _raw raw
fi
