#compdef git-workspace

autoload -U is-at-least

_git-workspace() {
    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[@]}" : \
'-w+[]:WORKSPACE:_files' \
'--workspace=[]:WORKSPACE:_files' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_git-workspace_commands" \
"*::: :->git-workspace" \
&& ret=0
    case $state in
    (git-workspace)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:git-workspace-command-$line[1]:"
        case $line[1] in
            (update)
_arguments "${_arguments_options[@]}" : \
'-t+[]:THREADS:_default' \
'--threads=[]:THREADS:_default' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(fetch)
_arguments "${_arguments_options[@]}" : \
'-t+[]:THREADS:_default' \
'--threads=[]:THREADS:_default' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(lock)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(switch-and-pull)
_arguments "${_arguments_options[@]}" : \
'-t+[]:THREADS:_default' \
'--threads=[]:THREADS:_default' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(list)
_arguments "${_arguments_options[@]}" : \
'--full[]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(archive)
_arguments "${_arguments_options[@]}" : \
'--force[Disable confirmation prompt]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(run)
_arguments "${_arguments_options[@]}" : \
'-t+[]:THREADS:_default' \
'--threads=[]:THREADS:_default' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':command:_default' \
'*::args:_default' \
&& ret=0
;;
(add)
_arguments "${_arguments_options[@]}" : \
'--file=[]:FILE:_files' \
'-h[Print help]' \
'--help[Print help]' \
":: :_git-workspace__add_commands" \
"*::: :->add" \
&& ret=0

    case $state in
    (add)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:git-workspace-add-command-$line[1]:"
        case $line[1] in
            (gitea)
_arguments "${_arguments_options[@]}" : \
'--path=[Clone repos to a specific path]:PATH:_default' \
'-e+[Environment variable containing the auth token]:ENV_VAR:_default' \
'--env-name=[Environment variable containing the auth token]:ENV_VAR:_default' \
'*--include=[Only clone repositories that match these regular expressions]:INCLUDE:_default' \
'*--exclude=[Don'\''t clone repositories that match these regular expressions]:EXCLUDE:_default' \
'--url=[Gitea instance URL]:URL:_default' \
'--skip-forks[Don'\''t clone forked repositories]' \
'--auth-http[Use HTTP authentication instead of SSH]' \
'-h[Print help]' \
'--help[Print help]' \
':name -- The name of the user or organisation to add:_default' \
&& ret=0
;;
(gitlab)
_arguments "${_arguments_options[@]}" : \
'--url=[Gitlab instance URL]:URL:_default' \
'--path=[Clone repos to a specific path]:PATH:_default' \
'-e+[Environment variable containing the auth token]:ENV_VAR:_default' \
'--env-name=[Environment variable containing the auth token]:ENV_VAR:_default' \
'*--include=[Only clone repositories that match these regular expressions. The repository name includes the user or organisation name]:INCLUDE:_default' \
'*--exclude=[Don'\''t clone repositories that match these regular expressions. The repository name includes the user or organisation name]:EXCLUDE:_default' \
'--auth-http[Use HTTP authentication instead of SSH]' \
'-h[Print help]' \
'--help[Print help]' \
':name -- The name of the gitlab group or namespace to add. Can include slashes:_default' \
&& ret=0
;;
(github)
_arguments "${_arguments_options[@]}" : \
'--path=[Clone repositories to a specific base path]:PATH:_default' \
'-e+[Environment variable containing the auth token]:ENV_VAR:_default' \
'--env-name=[Environment variable containing the auth token]:ENV_VAR:_default' \
'*--include=[Only clone repositories that match these regular expressions. The repository name includes the user or organisation name]:INCLUDE:_default' \
'*--exclude=[Don'\''t clone repositories that match these regular expressions. The repository name includes the user or organisation name]:EXCLUDE:_default' \
'--url=[Github instance URL, if using Github Enterprise this should be http(s)\://HOSTNAME/api/graphql]:URL:_default' \
'--skip-forks[Don'\''t clone forked repositories]' \
'--auth-http[Use HTTP authentication instead of SSH]' \
'-h[Print help]' \
'--help[Print help]' \
':name -- The name of the user or organisation to add:_default' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_git-workspace__add__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:git-workspace-add-help-command-$line[1]:"
        case $line[1] in
            (gitea)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(gitlab)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(github)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
;;
(completion)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
':shell -- The shell to generate the completion script for:(bash elvish fish powershell zsh)' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_git-workspace__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:git-workspace-help-command-$line[1]:"
        case $line[1] in
            (update)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(fetch)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(lock)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(switch-and-pull)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(archive)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(run)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(add)
_arguments "${_arguments_options[@]}" : \
":: :_git-workspace__help__add_commands" \
"*::: :->add" \
&& ret=0

    case $state in
    (add)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:git-workspace-help-add-command-$line[1]:"
        case $line[1] in
            (gitea)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(gitlab)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(github)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
(completion)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_git-workspace_commands] )) ||
_git-workspace_commands() {
    local commands; commands=(
'update:Update the workspace, removing and adding any repositories as needed' \
'fetch:Fetch new commits for all repositories in the workspace' \
'lock:Fetch all repositories from configured providers and write the lockfile' \
'switch-and-pull:Pull new commits on the primary branch for all repositories in the workspace' \
'list:List all repositories in the workspace' \
'archive:Archive repositories that don'\''t exist in the workspace anymore' \
'run:Run a git command in all repositories' \
'add:Add a provider to the configuration' \
'completion:Generate shell completions' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'git-workspace commands' commands "$@"
}
(( $+functions[_git-workspace__add_commands] )) ||
_git-workspace__add_commands() {
    local commands; commands=(
'gitea:Add a Gitea user or organization by name' \
'gitlab:Add a Gitlab user or group by name' \
'github:Add a Github user or organization by name' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'git-workspace add commands' commands "$@"
}
(( $+functions[_git-workspace__add__gitea_commands] )) ||
_git-workspace__add__gitea_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace add gitea commands' commands "$@"
}
(( $+functions[_git-workspace__add__github_commands] )) ||
_git-workspace__add__github_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace add github commands' commands "$@"
}
(( $+functions[_git-workspace__add__gitlab_commands] )) ||
_git-workspace__add__gitlab_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace add gitlab commands' commands "$@"
}
(( $+functions[_git-workspace__add__help_commands] )) ||
_git-workspace__add__help_commands() {
    local commands; commands=(
'gitea:Add a Gitea user or organization by name' \
'gitlab:Add a Gitlab user or group by name' \
'github:Add a Github user or organization by name' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'git-workspace add help commands' commands "$@"
}
(( $+functions[_git-workspace__add__help__gitea_commands] )) ||
_git-workspace__add__help__gitea_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace add help gitea commands' commands "$@"
}
(( $+functions[_git-workspace__add__help__github_commands] )) ||
_git-workspace__add__help__github_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace add help github commands' commands "$@"
}
(( $+functions[_git-workspace__add__help__gitlab_commands] )) ||
_git-workspace__add__help__gitlab_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace add help gitlab commands' commands "$@"
}
(( $+functions[_git-workspace__add__help__help_commands] )) ||
_git-workspace__add__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace add help help commands' commands "$@"
}
(( $+functions[_git-workspace__archive_commands] )) ||
_git-workspace__archive_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace archive commands' commands "$@"
}
(( $+functions[_git-workspace__completion_commands] )) ||
_git-workspace__completion_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace completion commands' commands "$@"
}
(( $+functions[_git-workspace__fetch_commands] )) ||
_git-workspace__fetch_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace fetch commands' commands "$@"
}
(( $+functions[_git-workspace__help_commands] )) ||
_git-workspace__help_commands() {
    local commands; commands=(
'update:Update the workspace, removing and adding any repositories as needed' \
'fetch:Fetch new commits for all repositories in the workspace' \
'lock:Fetch all repositories from configured providers and write the lockfile' \
'switch-and-pull:Pull new commits on the primary branch for all repositories in the workspace' \
'list:List all repositories in the workspace' \
'archive:Archive repositories that don'\''t exist in the workspace anymore' \
'run:Run a git command in all repositories' \
'add:Add a provider to the configuration' \
'completion:Generate shell completions' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'git-workspace help commands' commands "$@"
}
(( $+functions[_git-workspace__help__add_commands] )) ||
_git-workspace__help__add_commands() {
    local commands; commands=(
'gitea:Add a Gitea user or organization by name' \
'gitlab:Add a Gitlab user or group by name' \
'github:Add a Github user or organization by name' \
    )
    _describe -t commands 'git-workspace help add commands' commands "$@"
}
(( $+functions[_git-workspace__help__add__gitea_commands] )) ||
_git-workspace__help__add__gitea_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace help add gitea commands' commands "$@"
}
(( $+functions[_git-workspace__help__add__github_commands] )) ||
_git-workspace__help__add__github_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace help add github commands' commands "$@"
}
(( $+functions[_git-workspace__help__add__gitlab_commands] )) ||
_git-workspace__help__add__gitlab_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace help add gitlab commands' commands "$@"
}
(( $+functions[_git-workspace__help__archive_commands] )) ||
_git-workspace__help__archive_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace help archive commands' commands "$@"
}
(( $+functions[_git-workspace__help__completion_commands] )) ||
_git-workspace__help__completion_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace help completion commands' commands "$@"
}
(( $+functions[_git-workspace__help__fetch_commands] )) ||
_git-workspace__help__fetch_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace help fetch commands' commands "$@"
}
(( $+functions[_git-workspace__help__help_commands] )) ||
_git-workspace__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace help help commands' commands "$@"
}
(( $+functions[_git-workspace__help__list_commands] )) ||
_git-workspace__help__list_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace help list commands' commands "$@"
}
(( $+functions[_git-workspace__help__lock_commands] )) ||
_git-workspace__help__lock_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace help lock commands' commands "$@"
}
(( $+functions[_git-workspace__help__run_commands] )) ||
_git-workspace__help__run_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace help run commands' commands "$@"
}
(( $+functions[_git-workspace__help__switch-and-pull_commands] )) ||
_git-workspace__help__switch-and-pull_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace help switch-and-pull commands' commands "$@"
}
(( $+functions[_git-workspace__help__update_commands] )) ||
_git-workspace__help__update_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace help update commands' commands "$@"
}
(( $+functions[_git-workspace__list_commands] )) ||
_git-workspace__list_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace list commands' commands "$@"
}
(( $+functions[_git-workspace__lock_commands] )) ||
_git-workspace__lock_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace lock commands' commands "$@"
}
(( $+functions[_git-workspace__run_commands] )) ||
_git-workspace__run_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace run commands' commands "$@"
}
(( $+functions[_git-workspace__switch-and-pull_commands] )) ||
_git-workspace__switch-and-pull_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace switch-and-pull commands' commands "$@"
}
(( $+functions[_git-workspace__update_commands] )) ||
_git-workspace__update_commands() {
    local commands; commands=()
    _describe -t commands 'git-workspace update commands' commands "$@"
}

if [ "$funcstack[1]" = "_git-workspace" ]; then
    _git-workspace "$@"
else
    compdef _git-workspace git-workspace
fi
