vcspull import - vcspull.cli.import_cmd¶

vcspull import subcommand package.

Each supported service (GitHub, GitLab, Codeberg, Gitea, Forgejo, CodeCommit) is registered as a proper argparse subcommand so that vcspull import <service> --help shows only the flags relevant to that service.

vcspull.cli.import_cmd.create_import_subparser(parser)[source]¶

Wire per-service subparsers into the vcspull import parser.

Return type:

None

Parameters:

parser (argparse.ArgumentParser) – The import parser to attach service subcommands to.

Shared infrastructure for the vcspull import subcommand tree.

Provides parent argparse parsers (for flag composition via parents=[]) and the _run_import() function that all per-service handlers delegate to.

class vcspull.cli.import_cmd._common.Importer[source]¶

Bases: Protocol

Structural type for any remote service importer.

service_name: str¶
fetch_repos(options)[source]¶

Yield repositories matching options.

Return type:

Iterator[RemoteRepo]

Parameters:

options (ImportOptions)

__init__(*args, **kwargs)[source]¶
_abc_impl = <_abc._abc_data object>¶
_is_protocol = True¶
vcspull.cli.import_cmd._common._create_shared_parent()[source]¶

Create parent parser with workspace, filtering, and output flags.

Return type:

ArgumentParser

Returns:

Parent parser (add_help=False) carrying flags shared by all import service subcommands.

Return type:

argparse.ArgumentParser

vcspull.cli.import_cmd._common._create_token_parent()[source]¶

Create parent parser with the --token flag.

Return type:

ArgumentParser

Returns:

Parent parser carrying --token.

Return type:

argparse.ArgumentParser

vcspull.cli.import_cmd._common._create_mode_parent()[source]¶

Create parent parser with the -m/--mode flag.

Return type:

ArgumentParser

Returns:

Parent parser carrying -m/--mode.

Return type:

argparse.ArgumentParser

vcspull.cli.import_cmd._common._create_target_parent()[source]¶

Create parent parser with the required target positional.

Return type:

ArgumentParser

Returns:

Parent parser carrying the target positional argument.

Return type:

argparse.ArgumentParser

vcspull.cli.import_cmd._common._resolve_config_file(config_path_str)[source]¶

Resolve the config file path.

Return type:

Path

Parameters:

config_path_str (str | None) – Config file path from user, or None for default

Returns:

Resolved config file path

Return type:

pathlib.Path

vcspull.cli.import_cmd._common._run_import(importer, *, service_name, target, workspace, mode, language, topics, min_stars, include_archived, include_forks, limit, config_path_str, dry_run, yes, output_json, output_ndjson, color, use_https=False, flatten_groups=False)[source]¶

Run the import workflow for a single service.

This is the core fetch / preview / confirm / write logic shared by every per-service handler. The caller is responsible for constructing the importer instance; this function only orchestrates the import flow.

Return type:

int

Parameters:
  • importer (Importer) – Already-constructed importer instance (any object satisfying the Importer protocol)

  • service_name (str) – Canonical service name (e.g. "github", "gitlab", "codecommit")

  • target (str) – User, org, or search query

  • workspace (str) – Workspace root directory

  • mode (str) – Import mode (user, org, search)

  • language (str | None) – Language filter

  • topics (str | None) – Topics filter (comma-separated)

  • min_stars (int) – Minimum stars filter

  • include_archived (bool) – Include archived repositories

  • include_forks (bool) – Include forked repositories

  • limit (int) – Maximum repositories to fetch

  • config_path_str (str | None) – Config file path

  • dry_run (bool) – Preview without writing

  • yes (bool) – Skip confirmation

  • output_json (bool) – Output as JSON

  • output_ndjson (bool) – Output as NDJSON

  • color (str) – Color mode

  • use_https (bool) – Use HTTPS clone URLs instead of SSH (default: False, i.e., SSH)

  • flatten_groups (bool) – For GitLab org imports, flatten subgroup paths into base workspace

Returns:

0 on success, 1 on error

Return type:

int