#compdef topgrade

autoload -U is-at-least

_topgrade() {
    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[@]}" \
'*--disable=[Do not perform upgrades for the given steps]:STEP:(am app_man asdf atom audit bin bob brew_cask brew_formula bun bun_packages cargo chezmoi chocolatey choosenim composer conda config_update containers custom_commands deb_get deno distrobox dkp_pacman dotnet emacs firmware flatpak flutter fossil gcloud gem ghcup github_cli_extensions git_repos gnome_shell_extensions go guix haxelib helm home_manager jetpack julia juliaup kakoune helix krew lure macports mamba miktex mas maza micro myrepos nix node opam pacdef pacstall pearl pip3 pip_review pip_review_local pipupgrade pipx pkg pkgin pnpm powershell protonup raco rcm remotes restarts rtcl ruby_gems rustup scoop sdkman self_update sheldon shell snap sparkle spicetify stack stew system tldr tlmgr tmux toolbx vagrant vcpkg vim vscode winget wsl wsl_update yadm yarn)' \
'*--only=[Perform only the specified steps (experimental)]:STEP:(am app_man asdf atom audit bin bob brew_cask brew_formula bun bun_packages cargo chezmoi chocolatey choosenim composer conda config_update containers custom_commands deb_get deno distrobox dkp_pacman dotnet emacs firmware flatpak flutter fossil gcloud gem ghcup github_cli_extensions git_repos gnome_shell_extensions go guix haxelib helm home_manager jetpack julia juliaup kakoune helix krew lure macports mamba miktex mas maza micro myrepos nix node opam pacdef pacstall pearl pip3 pip_review pip_review_local pipupgrade pipx pkg pkgin pnpm powershell protonup raco rcm remotes restarts rtcl ruby_gems rustup scoop sdkman self_update sheldon shell snap sparkle spicetify stack stew system tldr tlmgr tmux toolbx vagrant vcpkg vim vscode winget wsl wsl_update yadm yarn)' \
'*--custom-commands=[Run only specific custom commands]:NAME: ' \
'*--env=[Set environment variables]:NAME=VALUE: ' \
'*-y+[Say yes to package manager'\''s prompt]' \
'*--yes=[Say yes to package manager'\''s prompt]' \
'--config=[Alternative configuration file]:PATH:_files' \
'--remote-host-limit=[A regular expression for restricting remote host execution]:REGEX: ' \
'--log-filter=[Tracing filter directives]:LOG_FILTER: ' \
'--gen-completion=[Print completion script for the given shell and exit]:GEN_COMPLETION:(bash elvish fish powershell zsh)' \
'--edit-config[Edit the configuration file]' \
'--config-reference[Show config reference]' \
'-t[Run inside tmux]' \
'--tmux[Run inside tmux]' \
'-c[Cleanup temporary or old files]' \
'--cleanup[Cleanup temporary or old files]' \
'-n[Print what would be done]' \
'--dry-run[Print what would be done]' \
'--no-retry[Do not ask to retry failed steps]' \
'-v[Output debug logs. Alias for \`--log-filter debug\`]' \
'--verbose[Output debug logs. Alias for \`--log-filter debug\`]' \
'-k[Prompt for a key before exiting]' \
'--keep[Prompt for a key before exiting]' \
'--skip-notify[Skip sending a notification at the end of a run]' \
'--disable-predefined-git-repos[Don'\''t pull the predefined git repos]' \
'--show-skipped[Show the reason for skipped steps]' \
'--gen-manpage[Print roff manpage and exit]' \
'--no-self-update[Don'\''t update Topgrade]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
&& ret=0
}

(( $+functions[_topgrade_commands] )) ||
_topgrade_commands() {
    local commands; commands=()
    _describe -t commands 'topgrade commands' commands "$@"
}

if [ "$funcstack[1]" = "_topgrade" ]; then
    _topgrade "$@"
else
    compdef _topgrade topgrade
fi
