Skip to content

Add --dry-run flag to mv#341

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

Add --dry-run flag to mv#341
AndreyVMarkelov merged 1 commit into
masterfrom
feature/mv-dry-run

Conversation

@AndreyVMarkelov

@AndreyVMarkelov AndreyVMarkelov commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

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

This is the third command to adopt the shared dry-run helpers. It adds:

  • writeDryRunRelocationLine — the from/to text form of writeDryRunLine
  • newPlannedRelocationResult — builds a planned relocation result from source metadata

cp is unaffected

cp shares the relocation parsing (parseRelocationOptions) and relocation_* helpers but does not register --dry-run. parseRelocationOptions guards the flag lookup (Lookup(dryRunFlagName) != nil), so cp resolves dryRun: false and its runtime path is untouched. Regression-checked: cp.go is unchanged and all cp tests pass.

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

mv --dry-run previews the intended move and reports planned for every source; it does not evaluate --if-exists conflict resolution (so it won't preview skipped or a destination-exists error). This matches the "preview intended writes" framing of the flag. Happy to tighten this to honor --if-exists in a follow-up if reviewers prefer exact-outcome fidelity.

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

Adds a writeDryRunRelocationLine helper for the from/to text form and a
newPlannedRelocationResult builder. cp shares the relocation parsing but
does not register --dry-run, so parseRelocationOptions guards the flag
lookup and cp is unaffected.

Updates the help manifest, JSON contract, input/definition schemas, and docs
to include the dry_run input and planned status for mv.
@AndreyVMarkelov AndreyVMarkelov merged commit e508ad7 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