#compdef alpm-files

autoload -U is-at-least

_alpm-files() {
    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 (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_alpm-files_commands" \
"*::: :->alpm-files" \
&& ret=0
    case $state in
    (alpm-files)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:alpm-files-command-$line[1]:"
        case $line[1] in
            (create)
_arguments "${_arguments_options[@]}" : \
'-o+[A file path to write to.]:OUTPUT:_files' \
'--output=[A file path to write to.]:OUTPUT:_files' \
'-s+[Which style of the alpm-files format to use.]:STYLE:((db\:"The alpm-db-files style."
repo\:"The alpm-repo-files style."))' \
'--style=[Which style of the alpm-files format to use.]:STYLE:((db\:"The alpm-db-files style."
repo\:"The alpm-repo-files style."))' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':input_dir -- The directory to read from.:_files' \
&& ret=0
;;
(format)
_arguments "${_arguments_options[@]}" : \
'-i+[An input file to read from.]:INPUT_FILE:_files' \
'--input-file=[An input file to read from.]:INPUT_FILE:_files' \
'-f+[Set the output format.]:OUTPUT_FORMAT:((json\:"The JSON output format."
v1\:"The alpm-files output format."))' \
'--format=[Set the output format.]:OUTPUT_FORMAT:((json\:"The JSON output format."
v1\:"The alpm-files output format."))' \
'-o+[A file path to write to.]:OUTPUT:_files' \
'--output=[A file path to write to.]:OUTPUT:_files' \
'-s+[Which style of the alpm-files format to use.]:STYLE:((db\:"The alpm-db-files style."
repo\:"The alpm-repo-files style."))' \
'--style=[Which style of the alpm-files format to use.]:STYLE:((db\:"The alpm-db-files style."
repo\:"The alpm-repo-files style."))' \
'-p[Determines whether the output will be displayed in a pretty non-minimized fashion.]' \
'--pretty[Determines whether the output will be displayed in a pretty non-minimized fashion.]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(validate)
_arguments "${_arguments_options[@]}" : \
'-i+[An input file to read from.]:INPUT_FILE:_files' \
'--input-file=[An input file to read from.]:INPUT_FILE:_files' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_alpm-files__help_commands" \
"*::: :->help" \
&& ret=0

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

(( $+functions[_alpm-files_commands] )) ||
_alpm-files_commands() {
    local commands; commands=(
'create:Create alpm-files data from a directory.' \
'format:Read and validate alpm-files data and return it in another file format.' \
'validate:Validate an alpm-files file.' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'alpm-files commands' commands "$@"
}
(( $+functions[_alpm-files__create_commands] )) ||
_alpm-files__create_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-files create commands' commands "$@"
}
(( $+functions[_alpm-files__format_commands] )) ||
_alpm-files__format_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-files format commands' commands "$@"
}
(( $+functions[_alpm-files__help_commands] )) ||
_alpm-files__help_commands() {
    local commands; commands=(
'create:Create alpm-files data from a directory.' \
'format:Read and validate alpm-files data and return it in another file format.' \
'validate:Validate an alpm-files file.' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'alpm-files help commands' commands "$@"
}
(( $+functions[_alpm-files__help__create_commands] )) ||
_alpm-files__help__create_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-files help create commands' commands "$@"
}
(( $+functions[_alpm-files__help__format_commands] )) ||
_alpm-files__help__format_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-files help format commands' commands "$@"
}
(( $+functions[_alpm-files__help__help_commands] )) ||
_alpm-files__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-files help help commands' commands "$@"
}
(( $+functions[_alpm-files__help__validate_commands] )) ||
_alpm-files__help__validate_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-files help validate commands' commands "$@"
}
(( $+functions[_alpm-files__validate_commands] )) ||
_alpm-files__validate_commands() {
    local commands; commands=()
    _describe -t commands 'alpm-files validate commands' commands "$@"
}

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