# AUTOMATICALLY GENERATED by https://github.com/tqdm/shtab

_shtab_vcspull_import_subparsers=(github gh gitlab gl codeberg cb gitea forgejo codecommit cc aws)
_shtab_vcspull_worktree_subparsers=(list sync prune)
_shtab_vcspull_subparsers=(sync list status search add discover fmt migrate import worktree)

_shtab_vcspull_sync_option_strings=(-h --help -f --file -w --workspace --workspace-root --dry-run -n --json --ndjson --color --exit-on-error -x --show-unchanged --summary-only --long --relative-paths --fetch --offline -v --verbose --all -a --include-worktrees --timeout --panel-lines --log-file --no-log-file)
_shtab_vcspull_list_option_strings=(-h --help -f --file -w --workspace --workspace-root --tree --json --ndjson --color --include-worktrees)
_shtab_vcspull_status_option_strings=(-h --help -f --file -w --workspace --workspace-root --detailed -d --json --ndjson --color --no-concurrent --sequential --max-concurrent)
_shtab_vcspull_search_option_strings=(-h --help -f --file -w --workspace --workspace-root --field -i --ignore-case -S --smart-case -F --fixed-strings --word-regexp -v --invert-match --any --json --ndjson --color)
_shtab_vcspull_add_option_strings=(-h --help --name --url --pin --shallow --depth -f --file -w --workspace --workspace-root --dry-run -n --no-merge -y --yes)
_shtab_vcspull_discover_option_strings=(-h --help -f --file -w --workspace --workspace-root --pin --shallow --depth --recursive -r --yes -y --dry-run -n --no-merge --include-worktrees)
_shtab_vcspull_fmt_option_strings=(-h --help -f --file --write -w --all --no-merge)
_shtab_vcspull_migrate_option_strings=(-h --help -f --file --write -w --all)
_shtab_vcspull_import_github_option_strings=(-h --help -w --workspace -l --language --topics --min-stars --archived --forks --limit -f --file --dry-run -n --yes -y --json --ndjson --https --sync --prune --prune-untracked --color --token -m --mode --url)
_shtab_vcspull_import_gh_option_strings=(-h --help -w --workspace -l --language --topics --min-stars --archived --forks --limit -f --file --dry-run -n --yes -y --json --ndjson --https --sync --prune --prune-untracked --color --token -m --mode --url)
_shtab_vcspull_import_gitlab_option_strings=(-h --help -w --workspace -l --language --topics --min-stars --archived --forks --limit -f --file --dry-run -n --yes -y --json --ndjson --https --sync --prune --prune-untracked --color --token -m --mode --url --flatten-groups --with-shared --skip-group)
_shtab_vcspull_import_gl_option_strings=(-h --help -w --workspace -l --language --topics --min-stars --archived --forks --limit -f --file --dry-run -n --yes -y --json --ndjson --https --sync --prune --prune-untracked --color --token -m --mode --url --flatten-groups --with-shared --skip-group)
_shtab_vcspull_import_codeberg_option_strings=(-h --help -w --workspace -l --language --topics --min-stars --archived --forks --limit -f --file --dry-run -n --yes -y --json --ndjson --https --sync --prune --prune-untracked --color --token -m --mode)
_shtab_vcspull_import_cb_option_strings=(-h --help -w --workspace -l --language --topics --min-stars --archived --forks --limit -f --file --dry-run -n --yes -y --json --ndjson --https --sync --prune --prune-untracked --color --token -m --mode)
_shtab_vcspull_import_gitea_option_strings=(-h --help -w --workspace -l --language --topics --min-stars --archived --forks --limit -f --file --dry-run -n --yes -y --json --ndjson --https --sync --prune --prune-untracked --color --token -m --mode --url)
_shtab_vcspull_import_forgejo_option_strings=(-h --help -w --workspace -l --language --topics --min-stars --archived --forks --limit -f --file --dry-run -n --yes -y --json --ndjson --https --sync --prune --prune-untracked --color --token -m --mode --url)
_shtab_vcspull_import_codecommit_option_strings=(-h --help -w --workspace -l --language --topics --min-stars --archived --forks --limit -f --file --dry-run -n --yes -y --json --ndjson --https --sync --prune --prune-untracked --color --region --profile)
_shtab_vcspull_import_cc_option_strings=(-h --help -w --workspace -l --language --topics --min-stars --archived --forks --limit -f --file --dry-run -n --yes -y --json --ndjson --https --sync --prune --prune-untracked --color --region --profile)
_shtab_vcspull_import_aws_option_strings=(-h --help -w --workspace -l --language --topics --min-stars --archived --forks --limit -f --file --dry-run -n --yes -y --json --ndjson --https --sync --prune --prune-untracked --color --region --profile)
_shtab_vcspull_import_option_strings=(-h --help)
_shtab_vcspull_worktree_list_option_strings=(-h --help -f --file -w --workspace --workspace-root --json --ndjson --color)
_shtab_vcspull_worktree_sync_option_strings=(-h --help -f --file -w --workspace --workspace-root --json --ndjson --color --dry-run -n)
_shtab_vcspull_worktree_prune_option_strings=(-h --help -f --file -w --workspace --workspace-root --json --ndjson --color --dry-run -n)
_shtab_vcspull_worktree_option_strings=(-h --help)
_shtab_vcspull_option_strings=(-h --help --version -V --log-level)

_shtab_vcspull_sync__f_COMPGEN=_shtab_compgen_files
_shtab_vcspull_sync___file_COMPGEN=_shtab_compgen_files

_shtab_vcspull_sync___color_choices=(auto always never)
_shtab_vcspull_list___color_choices=(auto always never)
_shtab_vcspull_status___color_choices=(auto always never)
_shtab_vcspull_search___color_choices=(auto always never)
_shtab_vcspull_import_github___color_choices=(auto always never)
_shtab_vcspull_import_github__m_choices=(user org search)
_shtab_vcspull_import_github___mode_choices=(user org search)
_shtab_vcspull_import_gh___color_choices=(auto always never)
_shtab_vcspull_import_gh__m_choices=(user org search)
_shtab_vcspull_import_gh___mode_choices=(user org search)
_shtab_vcspull_import_gitlab___color_choices=(auto always never)
_shtab_vcspull_import_gitlab__m_choices=(user org search)
_shtab_vcspull_import_gitlab___mode_choices=(user org search)
_shtab_vcspull_import_gl___color_choices=(auto always never)
_shtab_vcspull_import_gl__m_choices=(user org search)
_shtab_vcspull_import_gl___mode_choices=(user org search)
_shtab_vcspull_import_codeberg___color_choices=(auto always never)
_shtab_vcspull_import_codeberg__m_choices=(user org search)
_shtab_vcspull_import_codeberg___mode_choices=(user org search)
_shtab_vcspull_import_cb___color_choices=(auto always never)
_shtab_vcspull_import_cb__m_choices=(user org search)
_shtab_vcspull_import_cb___mode_choices=(user org search)
_shtab_vcspull_import_gitea___color_choices=(auto always never)
_shtab_vcspull_import_gitea__m_choices=(user org search)
_shtab_vcspull_import_gitea___mode_choices=(user org search)
_shtab_vcspull_import_forgejo___color_choices=(auto always never)
_shtab_vcspull_import_forgejo__m_choices=(user org search)
_shtab_vcspull_import_forgejo___mode_choices=(user org search)
_shtab_vcspull_import_codecommit___color_choices=(auto always never)
_shtab_vcspull_import_cc___color_choices=(auto always never)
_shtab_vcspull_import_aws___color_choices=(auto always never)
_shtab_vcspull_import_pos_0_choices=(github gh gitlab gl codeberg cb gitea forgejo codecommit cc aws)
_shtab_vcspull_worktree_list___color_choices=(auto always never)
_shtab_vcspull_worktree_sync___color_choices=(auto always never)
_shtab_vcspull_worktree_prune___color_choices=(auto always never)
_shtab_vcspull_worktree_pos_0_choices=(list sync prune)
_shtab_vcspull_pos_0_choices=(sync list status search add discover fmt migrate import worktree)

_shtab_vcspull_sync_pos_0_nargs='*'
_shtab_vcspull_sync__h_nargs=0
_shtab_vcspull_sync___help_nargs=0
_shtab_vcspull_sync___dry_run_nargs=0
_shtab_vcspull_sync__n_nargs=0
_shtab_vcspull_sync___json_nargs=0
_shtab_vcspull_sync___ndjson_nargs=0
_shtab_vcspull_sync___exit_on_error_nargs=0
_shtab_vcspull_sync__x_nargs=0
_shtab_vcspull_sync___show_unchanged_nargs=0
_shtab_vcspull_sync___summary_only_nargs=0
_shtab_vcspull_sync___long_nargs=0
_shtab_vcspull_sync___relative_paths_nargs=0
_shtab_vcspull_sync___fetch_nargs=0
_shtab_vcspull_sync___offline_nargs=0
_shtab_vcspull_sync__v_nargs=0
_shtab_vcspull_sync___verbose_nargs=0
_shtab_vcspull_sync___all_nargs=0
_shtab_vcspull_sync__a_nargs=0
_shtab_vcspull_sync___include_worktrees_nargs=0
_shtab_vcspull_sync___no_log_file_nargs=0
_shtab_vcspull_list_pos_0_nargs='*'
_shtab_vcspull_list__h_nargs=0
_shtab_vcspull_list___help_nargs=0
_shtab_vcspull_list___tree_nargs=0
_shtab_vcspull_list___json_nargs=0
_shtab_vcspull_list___ndjson_nargs=0
_shtab_vcspull_list___include_worktrees_nargs=0
_shtab_vcspull_status_pos_0_nargs='*'
_shtab_vcspull_status__h_nargs=0
_shtab_vcspull_status___help_nargs=0
_shtab_vcspull_status___detailed_nargs=0
_shtab_vcspull_status__d_nargs=0
_shtab_vcspull_status___json_nargs=0
_shtab_vcspull_status___ndjson_nargs=0
_shtab_vcspull_status___no_concurrent_nargs=0
_shtab_vcspull_status___sequential_nargs=0
_shtab_vcspull_search_pos_0_nargs='*'
_shtab_vcspull_search__h_nargs=0
_shtab_vcspull_search___help_nargs=0
_shtab_vcspull_search__i_nargs=0
_shtab_vcspull_search___ignore_case_nargs=0
_shtab_vcspull_search__S_nargs=0
_shtab_vcspull_search___smart_case_nargs=0
_shtab_vcspull_search__F_nargs=0
_shtab_vcspull_search___fixed_strings_nargs=0
_shtab_vcspull_search___word_regexp_nargs=0
_shtab_vcspull_search__v_nargs=0
_shtab_vcspull_search___invert_match_nargs=0
_shtab_vcspull_search___any_nargs=0
_shtab_vcspull_search___json_nargs=0
_shtab_vcspull_search___ndjson_nargs=0
_shtab_vcspull_add__h_nargs=0
_shtab_vcspull_add___help_nargs=0
_shtab_vcspull_add___shallow_nargs=0
_shtab_vcspull_add___dry_run_nargs=0
_shtab_vcspull_add__n_nargs=0
_shtab_vcspull_add___no_merge_nargs=0
_shtab_vcspull_add__y_nargs=0
_shtab_vcspull_add___yes_nargs=0
_shtab_vcspull_discover__h_nargs=0
_shtab_vcspull_discover___help_nargs=0
_shtab_vcspull_discover___shallow_nargs=0
_shtab_vcspull_discover___recursive_nargs=0
_shtab_vcspull_discover__r_nargs=0
_shtab_vcspull_discover___yes_nargs=0
_shtab_vcspull_discover__y_nargs=0
_shtab_vcspull_discover___dry_run_nargs=0
_shtab_vcspull_discover__n_nargs=0
_shtab_vcspull_discover___no_merge_nargs=0
_shtab_vcspull_discover___include_worktrees_nargs=0
_shtab_vcspull_fmt__h_nargs=0
_shtab_vcspull_fmt___help_nargs=0
_shtab_vcspull_fmt___write_nargs=0
_shtab_vcspull_fmt__w_nargs=0
_shtab_vcspull_fmt___all_nargs=0
_shtab_vcspull_fmt___no_merge_nargs=0
_shtab_vcspull_migrate__h_nargs=0
_shtab_vcspull_migrate___help_nargs=0
_shtab_vcspull_migrate___write_nargs=0
_shtab_vcspull_migrate__w_nargs=0
_shtab_vcspull_migrate___all_nargs=0
_shtab_vcspull_import_github__h_nargs=0
_shtab_vcspull_import_github___help_nargs=0
_shtab_vcspull_import_github___archived_nargs=0
_shtab_vcspull_import_github___forks_nargs=0
_shtab_vcspull_import_github___dry_run_nargs=0
_shtab_vcspull_import_github__n_nargs=0
_shtab_vcspull_import_github___yes_nargs=0
_shtab_vcspull_import_github__y_nargs=0
_shtab_vcspull_import_github___json_nargs=0
_shtab_vcspull_import_github___ndjson_nargs=0
_shtab_vcspull_import_github___https_nargs=0
_shtab_vcspull_import_github___sync_nargs=0
_shtab_vcspull_import_github___prune_nargs=0
_shtab_vcspull_import_github___prune_untracked_nargs=0
_shtab_vcspull_import_gh__h_nargs=0
_shtab_vcspull_import_gh___help_nargs=0
_shtab_vcspull_import_gh___archived_nargs=0
_shtab_vcspull_import_gh___forks_nargs=0
_shtab_vcspull_import_gh___dry_run_nargs=0
_shtab_vcspull_import_gh__n_nargs=0
_shtab_vcspull_import_gh___yes_nargs=0
_shtab_vcspull_import_gh__y_nargs=0
_shtab_vcspull_import_gh___json_nargs=0
_shtab_vcspull_import_gh___ndjson_nargs=0
_shtab_vcspull_import_gh___https_nargs=0
_shtab_vcspull_import_gh___sync_nargs=0
_shtab_vcspull_import_gh___prune_nargs=0
_shtab_vcspull_import_gh___prune_untracked_nargs=0
_shtab_vcspull_import_gitlab__h_nargs=0
_shtab_vcspull_import_gitlab___help_nargs=0
_shtab_vcspull_import_gitlab___archived_nargs=0
_shtab_vcspull_import_gitlab___forks_nargs=0
_shtab_vcspull_import_gitlab___dry_run_nargs=0
_shtab_vcspull_import_gitlab__n_nargs=0
_shtab_vcspull_import_gitlab___yes_nargs=0
_shtab_vcspull_import_gitlab__y_nargs=0
_shtab_vcspull_import_gitlab___json_nargs=0
_shtab_vcspull_import_gitlab___ndjson_nargs=0
_shtab_vcspull_import_gitlab___https_nargs=0
_shtab_vcspull_import_gitlab___sync_nargs=0
_shtab_vcspull_import_gitlab___prune_nargs=0
_shtab_vcspull_import_gitlab___prune_untracked_nargs=0
_shtab_vcspull_import_gitlab___flatten_groups_nargs=0
_shtab_vcspull_import_gitlab___with_shared_nargs=0
_shtab_vcspull_import_gl__h_nargs=0
_shtab_vcspull_import_gl___help_nargs=0
_shtab_vcspull_import_gl___archived_nargs=0
_shtab_vcspull_import_gl___forks_nargs=0
_shtab_vcspull_import_gl___dry_run_nargs=0
_shtab_vcspull_import_gl__n_nargs=0
_shtab_vcspull_import_gl___yes_nargs=0
_shtab_vcspull_import_gl__y_nargs=0
_shtab_vcspull_import_gl___json_nargs=0
_shtab_vcspull_import_gl___ndjson_nargs=0
_shtab_vcspull_import_gl___https_nargs=0
_shtab_vcspull_import_gl___sync_nargs=0
_shtab_vcspull_import_gl___prune_nargs=0
_shtab_vcspull_import_gl___prune_untracked_nargs=0
_shtab_vcspull_import_gl___flatten_groups_nargs=0
_shtab_vcspull_import_gl___with_shared_nargs=0
_shtab_vcspull_import_codeberg__h_nargs=0
_shtab_vcspull_import_codeberg___help_nargs=0
_shtab_vcspull_import_codeberg___archived_nargs=0
_shtab_vcspull_import_codeberg___forks_nargs=0
_shtab_vcspull_import_codeberg___dry_run_nargs=0
_shtab_vcspull_import_codeberg__n_nargs=0
_shtab_vcspull_import_codeberg___yes_nargs=0
_shtab_vcspull_import_codeberg__y_nargs=0
_shtab_vcspull_import_codeberg___json_nargs=0
_shtab_vcspull_import_codeberg___ndjson_nargs=0
_shtab_vcspull_import_codeberg___https_nargs=0
_shtab_vcspull_import_codeberg___sync_nargs=0
_shtab_vcspull_import_codeberg___prune_nargs=0
_shtab_vcspull_import_codeberg___prune_untracked_nargs=0
_shtab_vcspull_import_cb__h_nargs=0
_shtab_vcspull_import_cb___help_nargs=0
_shtab_vcspull_import_cb___archived_nargs=0
_shtab_vcspull_import_cb___forks_nargs=0
_shtab_vcspull_import_cb___dry_run_nargs=0
_shtab_vcspull_import_cb__n_nargs=0
_shtab_vcspull_import_cb___yes_nargs=0
_shtab_vcspull_import_cb__y_nargs=0
_shtab_vcspull_import_cb___json_nargs=0
_shtab_vcspull_import_cb___ndjson_nargs=0
_shtab_vcspull_import_cb___https_nargs=0
_shtab_vcspull_import_cb___sync_nargs=0
_shtab_vcspull_import_cb___prune_nargs=0
_shtab_vcspull_import_cb___prune_untracked_nargs=0
_shtab_vcspull_import_gitea__h_nargs=0
_shtab_vcspull_import_gitea___help_nargs=0
_shtab_vcspull_import_gitea___archived_nargs=0
_shtab_vcspull_import_gitea___forks_nargs=0
_shtab_vcspull_import_gitea___dry_run_nargs=0
_shtab_vcspull_import_gitea__n_nargs=0
_shtab_vcspull_import_gitea___yes_nargs=0
_shtab_vcspull_import_gitea__y_nargs=0
_shtab_vcspull_import_gitea___json_nargs=0
_shtab_vcspull_import_gitea___ndjson_nargs=0
_shtab_vcspull_import_gitea___https_nargs=0
_shtab_vcspull_import_gitea___sync_nargs=0
_shtab_vcspull_import_gitea___prune_nargs=0
_shtab_vcspull_import_gitea___prune_untracked_nargs=0
_shtab_vcspull_import_forgejo__h_nargs=0
_shtab_vcspull_import_forgejo___help_nargs=0
_shtab_vcspull_import_forgejo___archived_nargs=0
_shtab_vcspull_import_forgejo___forks_nargs=0
_shtab_vcspull_import_forgejo___dry_run_nargs=0
_shtab_vcspull_import_forgejo__n_nargs=0
_shtab_vcspull_import_forgejo___yes_nargs=0
_shtab_vcspull_import_forgejo__y_nargs=0
_shtab_vcspull_import_forgejo___json_nargs=0
_shtab_vcspull_import_forgejo___ndjson_nargs=0
_shtab_vcspull_import_forgejo___https_nargs=0
_shtab_vcspull_import_forgejo___sync_nargs=0
_shtab_vcspull_import_forgejo___prune_nargs=0
_shtab_vcspull_import_forgejo___prune_untracked_nargs=0
_shtab_vcspull_import_codecommit__h_nargs=0
_shtab_vcspull_import_codecommit___help_nargs=0
_shtab_vcspull_import_codecommit___archived_nargs=0
_shtab_vcspull_import_codecommit___forks_nargs=0
_shtab_vcspull_import_codecommit___dry_run_nargs=0
_shtab_vcspull_import_codecommit__n_nargs=0
_shtab_vcspull_import_codecommit___yes_nargs=0
_shtab_vcspull_import_codecommit__y_nargs=0
_shtab_vcspull_import_codecommit___json_nargs=0
_shtab_vcspull_import_codecommit___ndjson_nargs=0
_shtab_vcspull_import_codecommit___https_nargs=0
_shtab_vcspull_import_codecommit___sync_nargs=0
_shtab_vcspull_import_codecommit___prune_nargs=0
_shtab_vcspull_import_codecommit___prune_untracked_nargs=0
_shtab_vcspull_import_cc__h_nargs=0
_shtab_vcspull_import_cc___help_nargs=0
_shtab_vcspull_import_cc___archived_nargs=0
_shtab_vcspull_import_cc___forks_nargs=0
_shtab_vcspull_import_cc___dry_run_nargs=0
_shtab_vcspull_import_cc__n_nargs=0
_shtab_vcspull_import_cc___yes_nargs=0
_shtab_vcspull_import_cc__y_nargs=0
_shtab_vcspull_import_cc___json_nargs=0
_shtab_vcspull_import_cc___ndjson_nargs=0
_shtab_vcspull_import_cc___https_nargs=0
_shtab_vcspull_import_cc___sync_nargs=0
_shtab_vcspull_import_cc___prune_nargs=0
_shtab_vcspull_import_cc___prune_untracked_nargs=0
_shtab_vcspull_import_aws__h_nargs=0
_shtab_vcspull_import_aws___help_nargs=0
_shtab_vcspull_import_aws___archived_nargs=0
_shtab_vcspull_import_aws___forks_nargs=0
_shtab_vcspull_import_aws___dry_run_nargs=0
_shtab_vcspull_import_aws__n_nargs=0
_shtab_vcspull_import_aws___yes_nargs=0
_shtab_vcspull_import_aws__y_nargs=0
_shtab_vcspull_import_aws___json_nargs=0
_shtab_vcspull_import_aws___ndjson_nargs=0
_shtab_vcspull_import_aws___https_nargs=0
_shtab_vcspull_import_aws___sync_nargs=0
_shtab_vcspull_import_aws___prune_nargs=0
_shtab_vcspull_import_aws___prune_untracked_nargs=0
_shtab_vcspull_import_pos_0_nargs=A...
_shtab_vcspull_import__h_nargs=0
_shtab_vcspull_import___help_nargs=0
_shtab_vcspull_worktree_list_pos_0_nargs='*'
_shtab_vcspull_worktree_list__h_nargs=0
_shtab_vcspull_worktree_list___help_nargs=0
_shtab_vcspull_worktree_list___json_nargs=0
_shtab_vcspull_worktree_list___ndjson_nargs=0
_shtab_vcspull_worktree_sync_pos_0_nargs='*'
_shtab_vcspull_worktree_sync__h_nargs=0
_shtab_vcspull_worktree_sync___help_nargs=0
_shtab_vcspull_worktree_sync___json_nargs=0
_shtab_vcspull_worktree_sync___ndjson_nargs=0
_shtab_vcspull_worktree_sync___dry_run_nargs=0
_shtab_vcspull_worktree_sync__n_nargs=0
_shtab_vcspull_worktree_prune_pos_0_nargs='*'
_shtab_vcspull_worktree_prune__h_nargs=0
_shtab_vcspull_worktree_prune___help_nargs=0
_shtab_vcspull_worktree_prune___json_nargs=0
_shtab_vcspull_worktree_prune___ndjson_nargs=0
_shtab_vcspull_worktree_prune___dry_run_nargs=0
_shtab_vcspull_worktree_prune__n_nargs=0
_shtab_vcspull_worktree_pos_0_nargs=A...
_shtab_vcspull_worktree__h_nargs=0
_shtab_vcspull_worktree___help_nargs=0
_shtab_vcspull_pos_0_nargs=A...
_shtab_vcspull__h_nargs=0
_shtab_vcspull___help_nargs=0
_shtab_vcspull___version_nargs=0
_shtab_vcspull__V_nargs=0


# $1=COMP_WORDS[1]
_shtab_compgen_files() {
  compgen -f -- $1  # files
}

# $1=COMP_WORDS[1]
_shtab_compgen_dirs() {
  compgen -d -- $1  # recurse into subdirs
}

# $1=COMP_WORDS[1]
_shtab_replace_nonword() {
  echo "${1//[^[:word:]]/_}"
}

# set default values (called for the initial parser & any subparsers)
_set_parser_defaults() {
  local subparsers_var="${prefix}_subparsers[@]"
  sub_parsers=${!subparsers_var-}

  local current_option_strings_var="${prefix}_option_strings[@]"
  current_option_strings=${!current_option_strings_var}

  completed_positional_actions=0

  _set_new_action "pos_${completed_positional_actions}" true
}

# $1=action identifier
# $2=positional action (bool)
# set all identifiers for an action's parameters
_set_new_action() {
  current_action="${prefix}_$(_shtab_replace_nonword $1)"

  local current_action_compgen_var=${current_action}_COMPGEN
  current_action_compgen="${!current_action_compgen_var-}"

  local current_action_choices_var="${current_action}_choices[@]"
  current_action_choices="${!current_action_choices_var-}"

  local current_action_nargs_var="${current_action}_nargs"
  if [ -n "${!current_action_nargs_var-}" ]; then
    current_action_nargs="${!current_action_nargs_var}"
  else
    current_action_nargs=1
  fi

  current_action_args_start_index=$(( $word_index + 1 - $pos_only ))

  current_action_is_positional=$2
}

# Notes:
# `COMPREPLY`: what will be rendered after completion is triggered
# `completing_word`: currently typed word to generate completions for
# `${!var}`: evaluates the content of `var` and expand its content as a variable
#     hello="world"
#     x="hello"
#     ${!x} -> ${hello} -> "world"
_shtab_vcspull() {
  local completing_word="${COMP_WORDS[COMP_CWORD]}"
  local previous_word="${COMP_WORDS[COMP_CWORD-1]}"
  local completed_positional_actions
  local current_action
  local current_action_args_start_index
  local current_action_choices
  local current_action_compgen
  local current_action_is_positional
  local current_action_nargs
  local current_option_strings
  local sub_parsers
  COMPREPLY=()

  local prefix=_shtab_vcspull
  local word_index=0
  local pos_only=0 # "--" delimiter not encountered yet
  _set_parser_defaults
  word_index=1

  # determine what arguments are appropriate for the current state
  # of the arg parser
  while [ $word_index -ne $COMP_CWORD ]; do
    local this_word="${COMP_WORDS[$word_index]}"

    if [[ $pos_only = 1 || " $this_word " != " -- " ]]; then
      if [[ -n $sub_parsers && " ${sub_parsers[@]} " == *" ${this_word} "* ]]; then
        # valid subcommand: add it to the prefix & reset the current action
        prefix="${prefix}_$(_shtab_replace_nonword $this_word)"
        _set_parser_defaults
      fi

      if [[ " ${current_option_strings[@]} " == *" ${this_word} "* ]]; then
        # a new action should be acquired (due to recognised option string or
        # no more input expected from current action);
        # the next positional action can fill in here
        _set_new_action $this_word false
      fi

      if [[ "$current_action_nargs" != "*" ]] && \
         [[ "$current_action_nargs" != "+" ]] && \
         [[ "$current_action_nargs" != "?" ]] && \
         [[ "$current_action_nargs" != *"..." ]] && \
         (( $word_index + 1 - $current_action_args_start_index - $pos_only >= \
            $current_action_nargs )); then
        $current_action_is_positional && let "completed_positional_actions += 1"
        _set_new_action "pos_${completed_positional_actions}" true
      fi
    else
      pos_only=1 # "--" delimiter encountered
    fi

    let "word_index+=1"
  done

  # Generate the completions

  COMPREPLY=()
  if [[ $pos_only = 0 && "${completing_word}" == -* ]]; then
    # optional argument started: use option strings
    while IFS= read -r line; do COMPREPLY+=("$line"); done < <(
      compgen -W "${current_option_strings[*]}" -- "${completing_word}")
  elif [[ "${previous_word}" =~ ^[0-9\&]*[\<\>]\>?$ ]]; then
    # handle redirection operators
    while IFS= read -r line; do COMPREPLY+=("$line"); done < <(compgen -f -- "${completing_word}")
  else
    # use choices & compgen
    [ -n "${current_action_compgen}" ] &&
      while IFS= read -r line; do COMPREPLY+=("$line"); done < <(
        "${current_action_compgen}" "${completing_word}")
    while IFS= read -r line; do COMPREPLY+=("$line"); done < <(
      compgen -W "${current_action_choices[*]}" -- "${completing_word}")
  fi

  return 0
}

complete -o filenames -F _shtab_vcspull vcspull
