Skip to content

Global --dry-run flag #83

Description

@Boomatang

Global --dry-run flag

Add a --dry-run flag that shows what the tool would do without actually doing it. No files are created, no repos are cloned, no remotes are added.

Born out of #34 where a dry run for --org was identified as important.

Supported commands

Command Dry run output
grab <url> Show the clone mode (worktree/standard), directory structure that would be created, and the clone command that would run
grab --org <user> (#34) List the repos that would be cloned, their clone mode, and target paths
grab -r <url/user> (#79) Show the remote name and URL that would be added to the current repo
grab -R <url/user> (#79) Show the remotes that would be added to each repo across GRAB_PATH

Usage

grab --dry-run git@github.com:User/repo.git
grab --dry-run --org boomatang
grab --dry-run -R Boomatang
grab --dry-run -r Boomatang

Flag interactions

--dry-run composes with all existing flags. The output reflects their effect:

grab --dry-run -s git@github.com:User/repo.git        # shows standard clone instead of worktree
grab --dry-run -S --org boomatang                      # shows shallow clone for each repo
grab --dry-run --org boomatang --limit 5 --site github.com  # shows the 5 repos that would be cloned from GitHub only
grab --dry-run -t git@github.com:User/repo.git         # shows temp directory as target path

Output

The dry run shows both the action that would be taken and the commands that would run. For each repo it should indicate:

  • Clone mode (worktree or standard)
  • Target directory path
  • Whether the path already exists (would be skipped)
  • The git command that would run

Behaviour

  • All output goes to stdout
  • Exit code 0 on success
  • Auth and API calls still happen where needed (e.g. --org still queries the API to know what repos exist)
  • ls-remote calls still happen where needed (e.g. -R still verifies remote existence)
  • Existing repos are reported as "would be skipped" rather than silently omitted

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions