#compdef alpm-buildinfo

autoload -U is-at-least

_alpm-buildinfo() {
    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-buildinfo_commands" \
"*::: :->alpm-buildinfo" \
&& ret=0
    case $state in
    (alpm-buildinfo)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:alpm-buildinfo-command-$line[1]:"
        case $line[1] in
            (create)
_arguments "${_arguments_options[@]}" : \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
":: :_alpm-buildinfo__create_commands" \
"*::: :->create" \
&& ret=0

    case $state in
    (create)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:alpm-buildinfo-create-command-$line[1]:"
        case $line[1] in
            (v1)
_arguments "${_arguments_options[@]}" : \
'--builddate=[Provide a builddate]:BUILDDATE:_default' \
'--builddir=[Provide a builddir]:BUILDDIR:_default' \
'*--buildenv=[Provide one or more buildenv]:BUILDENV:_default' \
'*--installed=[Provide one or more installed]:INSTALLED:_default' \
'*--options=[Provide one or more options]:OPTIONS:_default' \
'--packager=[Provide a packager]:PACKAGER:_default' \
'--pkgarch=[Provide a pkgarch]:PKGARCH:_default' \
'--pkgbase=[Provide a pkgbase]:PKGBASE:_default' \
'--pkgbuild-sha256sum=[Provide a pkgbuild_sha256sum]:PKGBUILD_SHA256SUM:_default' \
'--pkgname=[Provide a pkgname]:PKGNAME:_default' \
'--pkgver=[Provide a pkgver]:PKGVER:_default' \
'-h[Print help]' \
'--help[Print help]' \
'::output -- Provide a file to write to:_default' \
&& ret=0
;;
(v2)
_arguments "${_arguments_options[@]}" : \
'--builddate=[Provide a builddate]:BUILDDATE:_default' \
'--builddir=[Provide a builddir]:BUILDDIR:_default' \
'*--buildenv=[Provide one or more buildenv]:BUILDENV:_default' \
'*--installed=[Provide one or more installed]:INSTALLED:_default' \
'*--options=[Provide one or more options]:OPTIONS:_default' \
'--packager=[Provide a packager]:PACKAGER:_default' \
'--pkgarch=[Provide a pkgarch]:PKGARCH:_default' \
'--pkgbase=[Provide a pkgbase]:PKGBASE:_default' \
'--pkgbuild-sha256sum=[Provide a pkgbuild_sha256sum]:PKGBUILD_SHA256SUM:_default' \
'--pkgname=[Provide a pkgname]:PKGNAME:_default' \
'--pkgver=[Provide a pkgver]:PKGVER:_default' \
'--startdir=[Provide a startdir]:STARTDIR:_default' \
'--buildtool=[Provide a buildtool]:BUILDTOOL:_default' \
'--buildtoolver=[Provide a buildtoolver]:BUILDTOOLVER:_default' \
'-h[Print help]' \
'--help[Print help]' \
'::output -- Provide a file to write to:_default' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_alpm-buildinfo__create__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:alpm-buildinfo-create-help-command-$line[1]:"
        case $line[1] in
            (v1)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(v2)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
;;
(validate)
_arguments "${_arguments_options[@]}" : \
'-s+[Provide the BUILDINFO schema version to use]:VERSION:_default' \
'--schema=[Provide the BUILDINFO schema version to use]:VERSION:_default' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'::file -- Provide the file to read:_files' \
&& ret=0
;;
(format)
_arguments "${_arguments_options[@]}" : \
'-s+[Provide the BUILDINFO schema version to use]:VERSION:_default' \
'--schema=[Provide the BUILDINFO schema version to use]:VERSION:_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 -- Provide the file to read:_files' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_alpm-buildinfo__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:alpm-buildinfo-help-command-$line[1]:"
        case $line[1] in
            (create)
_arguments "${_arguments_options[@]}" : \
":: :_alpm-buildinfo__help__create_commands" \
"*::: :->create" \
&& ret=0

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

(( $+functions[_alpm-buildinfo_commands] )) ||
_alpm-buildinfo_commands() {
    local commands; commands=(
'create:Create a BUILDINFO file according to a schema' \
'validate:Validate a BUILDINFO file' \
'format:Parse a BUILDINFO file and output it in a different format' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'alpm-buildinfo commands' commands "$@"
}
(( $+functions[_alpm-buildinfo__create_commands] )) ||
_alpm-buildinfo__create_commands() {
    local commands; commands=(
'v1:Create a BUILDINFO version 1 file' \
'v2:Create a BUILDINFO version 2 file' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'alpm-buildinfo create commands' commands "$@"
}
(( $+functions[_alpm-buildinfo__create__help_commands] )) ||
_alpm-buildinfo__create__help_commands() {
    local commands; commands=(
'v1:Create a BUILDINFO version 1 file' \
'v2:Create a BUILDINFO version 2 file' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'alpm-buildinfo create help commands' commands "$@"
}
(( $+functions[_alpm-buildinfo__create__help__help_commands] )) ||
_alpm-buildinfo__create__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-buildinfo create help help commands' commands "$@"
}
(( $+functions[_alpm-buildinfo__create__help__v1_commands] )) ||
_alpm-buildinfo__create__help__v1_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-buildinfo create help v1 commands' commands "$@"
}
(( $+functions[_alpm-buildinfo__create__help__v2_commands] )) ||
_alpm-buildinfo__create__help__v2_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-buildinfo create help v2 commands' commands "$@"
}
(( $+functions[_alpm-buildinfo__create__v1_commands] )) ||
_alpm-buildinfo__create__v1_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-buildinfo create v1 commands' commands "$@"
}
(( $+functions[_alpm-buildinfo__create__v2_commands] )) ||
_alpm-buildinfo__create__v2_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-buildinfo create v2 commands' commands "$@"
}
(( $+functions[_alpm-buildinfo__format_commands] )) ||
_alpm-buildinfo__format_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-buildinfo format commands' commands "$@"
}
(( $+functions[_alpm-buildinfo__help_commands] )) ||
_alpm-buildinfo__help_commands() {
    local commands; commands=(
'create:Create a BUILDINFO file according to a schema' \
'validate:Validate a BUILDINFO file' \
'format:Parse a BUILDINFO file and output it in a different format' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'alpm-buildinfo help commands' commands "$@"
}
(( $+functions[_alpm-buildinfo__help__create_commands] )) ||
_alpm-buildinfo__help__create_commands() {
    local commands; commands=(
'v1:Create a BUILDINFO version 1 file' \
'v2:Create a BUILDINFO version 2 file' \
    )
    _describe -t commands 'alpm-buildinfo help create commands' commands "$@"
}
(( $+functions[_alpm-buildinfo__help__create__v1_commands] )) ||
_alpm-buildinfo__help__create__v1_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-buildinfo help create v1 commands' commands "$@"
}
(( $+functions[_alpm-buildinfo__help__create__v2_commands] )) ||
_alpm-buildinfo__help__create__v2_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-buildinfo help create v2 commands' commands "$@"
}
(( $+functions[_alpm-buildinfo__help__format_commands] )) ||
_alpm-buildinfo__help__format_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-buildinfo help format commands' commands "$@"
}
(( $+functions[_alpm-buildinfo__help__help_commands] )) ||
_alpm-buildinfo__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-buildinfo help help commands' commands "$@"
}
(( $+functions[_alpm-buildinfo__help__validate_commands] )) ||
_alpm-buildinfo__help__validate_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-buildinfo help validate commands' commands "$@"
}
(( $+functions[_alpm-buildinfo__validate_commands] )) ||
_alpm-buildinfo__validate_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-buildinfo validate commands' commands "$@"
}

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