#compdef alpm-srcinfo

autoload -U is-at-least

_alpm-srcinfo() {
    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[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_alpm-srcinfo_commands" \
"*::: :->alpm-srcinfo" \
&& ret=0
    case $state in
    (alpm-srcinfo)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:alpm-srcinfo-command-$line[1]:"
        case $line[1] in
            (create)
_arguments "${_arguments_options[@]}" : \
'-o+[Provide the output format]:OUTPUT_FORMAT:((json\:"The JSON output format"
srcinfo\:"The SRCINFO output format"))' \
'--output-format=[Provide the output format]:OUTPUT_FORMAT:((json\:"The JSON output format"
srcinfo\:"The SRCINFO output format"))' \
'-p[Pretty-print the output]' \
'--pretty[Pretty-print the output]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':file -- An optional input file path to read from:_files' \
&& ret=0
;;
(validate)
_arguments "${_arguments_options[@]}" : \
'-s+[Provide the SRCINFO schema version to use]:VERSION:_default' \
'--schema=[Provide the SRCINFO schema version to use]:VERSION:_default' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'::file -- An optional input file path to read from:_files' \
&& ret=0
;;
(format)
_arguments "${_arguments_options[@]}" : \
'-s+[Provide the SRCINFO schema version to use]:VERSION:_default' \
'--schema=[Provide the SRCINFO schema version to use]:VERSION:_default' \
'-o+[Provide the output format]:OUTPUT_FORMAT:((json\:"The JSON output format"
srcinfo\:"The SRCINFO output format"))' \
'--output-format=[Provide the output format]:OUTPUT_FORMAT:((json\:"The JSON output format"
srcinfo\:"The SRCINFO output format"))' \
'-p[Pretty-print the output]' \
'--pretty[Pretty-print the output]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'::file -- The file to read from:_files' \
&& ret=0
;;
(format-packages)
_arguments "${_arguments_options[@]}" : \
'-s+[Provide the SRCINFO schema version to use]:VERSION:_default' \
'--schema=[Provide the SRCINFO schema version to use]:VERSION:_default' \
'-a+[The selected architecture that should be used to interpret the SRCINFO file]:ARCHITECTURE:_default' \
'--architecture=[The selected architecture that should be used to interpret the SRCINFO file]:ARCHITECTURE:_default' \
'-o+[Provide the output format]:OUTPUT_FORMAT:((json\:"The JSON output format"))' \
'--output-format=[Provide the output format]:OUTPUT_FORMAT:((json\:"The JSON output format"))' \
'-p[Pretty-print the output]' \
'--pretty[Pretty-print the output]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'::file -- An optional input file path to read from:_files' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_alpm-srcinfo__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:alpm-srcinfo-help-command-$line[1]:"
        case $line[1] in
            (create)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(validate)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(format)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(format-packages)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_alpm-srcinfo_commands] )) ||
_alpm-srcinfo_commands() {
    local commands; commands=(
'create:Create a SRCINFO file from a PKGBUILD file at a given path' \
'validate:Validate a SRCINFO file from a path or \`stdin\`' \
'format:Format a SRCINFO file from a path or \`stdin\`' \
'format-packages:Format a SRCINFO file'\''s packages from a path or \`stdin\`' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'alpm-srcinfo commands' commands "$@"
}
(( $+functions[_alpm-srcinfo__create_commands] )) ||
_alpm-srcinfo__create_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-srcinfo create commands' commands "$@"
}
(( $+functions[_alpm-srcinfo__format_commands] )) ||
_alpm-srcinfo__format_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-srcinfo format commands' commands "$@"
}
(( $+functions[_alpm-srcinfo__format-packages_commands] )) ||
_alpm-srcinfo__format-packages_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-srcinfo format-packages commands' commands "$@"
}
(( $+functions[_alpm-srcinfo__help_commands] )) ||
_alpm-srcinfo__help_commands() {
    local commands; commands=(
'create:Create a SRCINFO file from a PKGBUILD file at a given path' \
'validate:Validate a SRCINFO file from a path or \`stdin\`' \
'format:Format a SRCINFO file from a path or \`stdin\`' \
'format-packages:Format a SRCINFO file'\''s packages from a path or \`stdin\`' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'alpm-srcinfo help commands' commands "$@"
}
(( $+functions[_alpm-srcinfo__help__create_commands] )) ||
_alpm-srcinfo__help__create_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-srcinfo help create commands' commands "$@"
}
(( $+functions[_alpm-srcinfo__help__format_commands] )) ||
_alpm-srcinfo__help__format_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-srcinfo help format commands' commands "$@"
}
(( $+functions[_alpm-srcinfo__help__format-packages_commands] )) ||
_alpm-srcinfo__help__format-packages_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-srcinfo help format-packages commands' commands "$@"
}
(( $+functions[_alpm-srcinfo__help__help_commands] )) ||
_alpm-srcinfo__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-srcinfo help help commands' commands "$@"
}
(( $+functions[_alpm-srcinfo__help__validate_commands] )) ||
_alpm-srcinfo__help__validate_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-srcinfo help validate commands' commands "$@"
}
(( $+functions[_alpm-srcinfo__validate_commands] )) ||
_alpm-srcinfo__validate_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-srcinfo validate commands' commands "$@"
}

if [ "$funcstack[1]" = "_alpm-srcinfo" ]; then
    _alpm-srcinfo "$@"
else
    compdef _alpm-srcinfo alpm-srcinfo
fi
