#compdef ayllu-shell

autoload -U is-at-least

_ayllu-shell() {
    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+[sh compatibility]:C:_default' \
'--config=[Path to a configuration file]:CONFIG:_files' \
'-u+[Specify the user identity to assume]:USERNAME:_default' \
'--username=[Specify the user identity to assume]:USERNAME:_default' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_ayllu-shell_commands" \
"*::: :->ayllu-shell" \
&& ret=0
    case $state in
    (ayllu-shell)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:ayllu-shell-command-$line[1]:"
        case $line[1] in
            (git-receive-pack)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
':path -- Path to the git repository:_files' \
&& ret=0
;;
(git-upload-pack)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
':path -- Path to the git repository:_files' \
&& ret=0
;;
(git-post-receive)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(git-post-commit)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_ayllu-shell__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:ayllu-shell-help-command-$line[1]:"
        case $line[1] in
            (git-receive-pack)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(git-upload-pack)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(git-post-receive)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(git-post-commit)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_ayllu-shell_commands] )) ||
_ayllu-shell_commands() {
    local commands; commands=(
'git-receive-pack:Invokes git-receive-pack' \
'git-upload-pack:Invokes git-upload-pack' \
'git-post-receive:Runs the post-update git hook, see (githooks.5)' \
'git-post-commit:Runs when a local git commit is made, see (githooks.5)' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'ayllu-shell commands' commands "$@"
}
(( $+functions[_ayllu-shell__subcmd__git-post-commit_commands] )) ||
_ayllu-shell__subcmd__git-post-commit_commands() {
    local commands; commands=()
    _describe -t commands 'ayllu-shell git-post-commit commands' commands "$@"
}
(( $+functions[_ayllu-shell__subcmd__git-post-receive_commands] )) ||
_ayllu-shell__subcmd__git-post-receive_commands() {
    local commands; commands=()
    _describe -t commands 'ayllu-shell git-post-receive commands' commands "$@"
}
(( $+functions[_ayllu-shell__subcmd__git-receive-pack_commands] )) ||
_ayllu-shell__subcmd__git-receive-pack_commands() {
    local commands; commands=()
    _describe -t commands 'ayllu-shell git-receive-pack commands' commands "$@"
}
(( $+functions[_ayllu-shell__subcmd__git-upload-pack_commands] )) ||
_ayllu-shell__subcmd__git-upload-pack_commands() {
    local commands; commands=()
    _describe -t commands 'ayllu-shell git-upload-pack commands' commands "$@"
}
(( $+functions[_ayllu-shell__subcmd__help_commands] )) ||
_ayllu-shell__subcmd__help_commands() {
    local commands; commands=(
'git-receive-pack:Invokes git-receive-pack' \
'git-upload-pack:Invokes git-upload-pack' \
'git-post-receive:Runs the post-update git hook, see (githooks.5)' \
'git-post-commit:Runs when a local git commit is made, see (githooks.5)' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'ayllu-shell help commands' commands "$@"
}
(( $+functions[_ayllu-shell__subcmd__help__subcmd__git-post-commit_commands] )) ||
_ayllu-shell__subcmd__help__subcmd__git-post-commit_commands() {
    local commands; commands=()
    _describe -t commands 'ayllu-shell help git-post-commit commands' commands "$@"
}
(( $+functions[_ayllu-shell__subcmd__help__subcmd__git-post-receive_commands] )) ||
_ayllu-shell__subcmd__help__subcmd__git-post-receive_commands() {
    local commands; commands=()
    _describe -t commands 'ayllu-shell help git-post-receive commands' commands "$@"
}
(( $+functions[_ayllu-shell__subcmd__help__subcmd__git-receive-pack_commands] )) ||
_ayllu-shell__subcmd__help__subcmd__git-receive-pack_commands() {
    local commands; commands=()
    _describe -t commands 'ayllu-shell help git-receive-pack commands' commands "$@"
}
(( $+functions[_ayllu-shell__subcmd__help__subcmd__git-upload-pack_commands] )) ||
_ayllu-shell__subcmd__help__subcmd__git-upload-pack_commands() {
    local commands; commands=()
    _describe -t commands 'ayllu-shell help git-upload-pack commands' commands "$@"
}
(( $+functions[_ayllu-shell__subcmd__help__subcmd__help_commands] )) ||
_ayllu-shell__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'ayllu-shell help help commands' commands "$@"
}

if [ "$funcstack[1]" = "_ayllu-shell" ]; then
    _ayllu-shell "$@"
else
    compdef _ayllu-shell ayllu-shell
fi
