Skip to content

Add --dry-run flag to rm#338

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

Add --dry-run flag to rm#338
AndreyVMarkelov merged 1 commit into
masterfrom
feature/rm-dry-run

Conversation

@AndreyVMarkelov

@AndreyVMarkelov AndreyVMarkelov commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a --dry-run flag to dbxcli rm that previews deletions without mutating anything. Dry-run still runs the existing validation (e.g. non-empty folder checks) but skips the DeleteV2 / PermanentlyDelete API calls, reports a planned JSON status, and prints Would delete / Would permanently delete in text mode.

Dry-run behavior is factored into a shared cmd/dry_run.go so future commands can reuse it:

  • addDryRunFlag / dryRunEnabled register and read the flag
  • plannedStatus collapses a real status to planned when dry-run is set
  • writeDryRunLine renders the Would <verb> <path> text

The help manifest, JSON contract, input/definition schemas, and docs are updated to include the dry_run input and planned status.

Test plan

  • go build ./... and go test ./cmd/ pass
  • Unit tests: text/JSON output, permanent mode, validation still fires in dry-run, JSON golden snapshot
  • Manual smoke tests against live Dropbox:
    • rm --dry-run, --dry-run --output json, --dry-run --permanent, and multi-target all print the plan
    • files verified untouched (same revisions) after every dry-run
    • real rm confirmed still deletes afterward

Add a --dry-run flag that previews deletions without mutating anything.
Dry-run still runs the existing validation (e.g. non-empty folder checks)
but skips the DeleteV2 / PermanentlyDelete API calls, reports a "planned"
JSON status, and prints "Would delete" / "Would permanently delete" in text
mode.

Dry-run behavior lives in a shared cmd/dry_run.go so future commands can
reuse it: addDryRunFlag/dryRunEnabled register and read the flag,
plannedStatus collapses a real status to "planned", and writeDryRunLine
renders the "Would <verb> <path>" text.

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