Add --dry-run flag to cp#342
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends dry-run support to
dbxcli cp, reusing the shared helpers fromcmd/dry_run.go. With--dry-run,cppreviews each intended copy without callingCopyV2: it resolves the destination (including into an existing folder), reports aplannedJSON status, and printsWould 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 resultrenderPlannedRelocationResults(dry_run.go) — renders the from/to text with a verb parameter (move/copy)mvnow delegates to these shared helpers (no behavior change; mv tests still pass).Behavior note:
--if-existsin dry-runConsistent with
mv,cp --dry-runpreviews the intended copy and reportsplannedfor every source; it does not evaluate--if-existsconflict resolution. This matches the "preview intended writes" framing of the flag.