Add --dry-run flag to mv#341
Merged
Merged
Conversation
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.
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 mv, reusing the shared helpers fromcmd/dry_run.go. With--dry-run,mvpreviews each intended move without callingMoveV2: it resolves the destination (including into an existing folder), reports aplannedJSON status, and printsWould 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 ofwriteDryRunLinenewPlannedRelocationResult— builds aplannedrelocation result from source metadatacp is unaffected
cpshares the relocation parsing (parseRelocationOptions) andrelocation_*helpers but does not register--dry-run.parseRelocationOptionsguards the flag lookup (Lookup(dryRunFlagName) != nil), socpresolvesdryRun: falseand its runtime path is untouched. Regression-checked:cp.gois unchanged and allcptests pass.Behavior note:
--if-existsin dry-runmv --dry-runpreviews the intended move and reportsplannedfor every source; it does not evaluate--if-existsconflict resolution (so it won't previewskippedor a destination-exists error). This matches the "preview intended writes" framing of the flag. Happy to tighten this to honor--if-existsin a follow-up if reviewers prefer exact-outcome fidelity.