Skip to content

Migrate rm and share-link revoke dry-run to renderOperation#352

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

Migrate rm and share-link revoke dry-run to renderOperation#352
AndreyVMarkelov merged 1 commit into
masterfrom
feature/dry-run-rm-revoke

Conversation

@AndreyVMarkelov

@AndreyVMarkelov AndreyVMarkelov commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Fourth PR in the dry-run generalization series. Routes rm's terminal output and renderShareLinkRevokeOutput through the shared renderOperation helper (#350), dropping the duplicated commandOutput(cmd).Render(..., newJSONCommandOperationOutput(cmd, ...)) glue.

Changes

  • cmd/rm.go — final render call uses renderOperation.
  • cmd/share_link_revoke.gorenderShareLinkRevokeOutput uses renderOperation.

Why this one needed care

Unlike the earlier migrations (single dry-run-only branch), rm and share-link revoke run one code path for both dry-run and live modes, gating only the destructive API call. The migration deliberately does not split that path: the text closures move into renderOperation verbatim, preserving their internal branching —

  • rm: the if !opts.dryRun && !opts.verbose { return nil } guard, then renderRemoveResults which prints "Would delete" vs "Deleted".
  • revoke: the if !input.DryRun { return nil } guard and per-URL loop.

Only the envelope construction is shared. Output is unchanged in both modes.

Route rm's terminal output and renderShareLinkRevokeOutput through the
shared renderOperation helper, dropping the duplicated
commandOutput/newJSONCommandOperationOutput glue.

Unlike the earlier migrations, these commands run one path for both dry
-run and live modes. The text closures move into renderOperation
verbatim, preserving their internal branching (rm's dry-run/verbose
guard and "Would delete"/"Deleted" logic, revoke's dry-run guard and
per-URL loop). Only the envelope construction is shared; output is
unchanged in both modes.

Verified against the full rm and share-link revoke suites, including the
byte-exact dry-run snapshots, verbose live-delete output, permanent and
multi-target deletes, and both revoke modes (URL and --path).
@AndreyVMarkelov AndreyVMarkelov merged commit dc67145 into master Jul 10, 2026
12 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