#compdef git-subrepo -P git\ ##subrepo
#description perform git-subrepo operations

# DO NOT EDIT. This file generated by pkg/bin/generate-completion.pl.

_git-subrepo() {
    typeset -A opt_args
    local curcontext="$curcontext" state line context

    _arguments -s \
        '1: :->subcmd' \
        '*: :->args' \
        '-h[Show the command summary]' \
        '--help[Help overview]' \
        '--version[Print the git-subrepo version number]' \
        '(-a --all)'{-a,--all}'[Perform command on all current subrepos]' \
        '(-A --ALL)'{-A,--ALL}'[Perform command on all subrepos and subsubrepos]' \
        '(-b --branch)'{-b,--branch}'[Specify the upstream branch to push/pull/fetch]:b' \
        '(-e --edit)'{-e,--edit}'[Edit commit message]' \
        '(-f --force)'{-f,--force}'[Force certain operations]' \
        '(-F --fetch)'{-F,--fetch}'[Fetch the upstream content first]' \
        '(-M --method)'{-M,--method}'[Join method: '"'"'merge'"'"' (default) or '"'"'rebase'"'"']:M' \
        '(-m --message)'{-m,--message}'[Specify a commit message]:m' \
        '--file[Specify a commit message file]:file' \
        '(-r --remote)'{-r,--remote}'[Specify the upstream remote to push/pull/fetch]:r' \
        '(-s --squash)'{-s,--squash}'[Squash commits on push]' \
        '(-u --update)'{-u,--update}'[Add the --branch and/or --remote overrides to .gitrepo]' \
        '(-q --quiet)'{-q,--quiet}'[Show minimal output]' \
        '(-v --verbose)'{-v,--verbose}'[Show verbose output]' \
        '(-d --debug)'{-d,--debug}'[Show the actual commands used]' \
        '(-x --DEBUG)'{-x,--DEBUG}'[Turn on -x Bash debugging]' \
 && ret=0

    case $state in
    subcmd)
        compadd branch clean clone commit config fetch help init pull push status upgrade version
    ;;

    args)
        case $line[1] in

        clone)
            _arguments -C \
                '1: :->subcmd' \
                '2: :->repo' \
                '*: :->subdir' \
                    && ret=0
                case $state in
                subdir|repo)
                    _files
                ;;
                esac
        ;;

        branch|clean|commit|config|fetch|pull|push|status)
            _compadd_subdirs
        ;;

        init)
            _files
        ;;

        help)
            compadd branch clean clone commit config fetch help init pull push status upgrade version
        ;;
        esac
    ;;
    esac

}

_compadd_subdirs() {
    local subrepos
    IFS=$'\n' set -A subrepos `git subrepo status -q`
    compadd -X "subrepos: " $subrepos
}
