Skip to content

Add --dry-run flag to cp#342

Merged
AndreyVMarkelov merged 1 commit into
masterfrom
feature/cp-dry-run
Jul 8, 2026
Merged

Add --dry-run flag to cp#342
AndreyVMarkelov merged 1 commit into
masterfrom
feature/cp-dry-run

Conversation

@AndreyVMarkelov

@AndreyVMarkelov AndreyVMarkelov commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Extends dry-run support to dbxcli cp, reusing the shared helpers from cmd/dry_run.go. With --dry-run, cp previews each intended copy without calling CopyV2: it resolves the destination (including into an existing folder), reports a planned JSON status, and prints Would copy <from> to <to> in text mode.

This is the fourth command to adopt the shared dry-run helpers (after rm, mkdir, mv). It also folds the mv-specific dry-run helpers into shared relocation code so both relocation commands use them:

  • plannedRelocationResult (relocation_output.go) — fetches source metadata and builds a planned result
  • renderPlannedRelocationResults (dry_run.go) — renders the from/to text with a verb parameter (move/copy)

mv now delegates to these shared helpers (no behavior change; mv tests still pass).

Behavior note: --if-exists in dry-run

Consistent with mv, cp --dry-run previews the intended copy and reports planned for every source; it does not evaluate --if-exists conflict resolution. This matches the "preview intended writes" framing of the flag.

Extend dry-run support to cp, reusing the shared helpers from dry_run.go.
With --dry-run, cp previews each intended copy without calling CopyV2: it
resolves the destination (including into an existing folder), reports a
"planned" JSON status, and prints "Would copy <from> to <to>" in text mode.

Fold the mv-specific dry-run helpers into shared relocation code so both
commands use them: plannedRelocationResult (relocation_output.go) fetches
source metadata and builds a planned result, and renderPlannedRelocationResults
(dry_run.go) renders the from/to text with a verb parameter ("move"/"copy").

Updates the help manifest, JSON contract, definition schema, and docs to
include the dry_run input and planned status for cp.
@AndreyVMarkelov AndreyVMarkelov merged commit 2a49d77 into master Jul 8, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant