Migrate rm and share-link revoke dry-run to renderOperation#352
Merged
Conversation
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).
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
Fourth PR in the dry-run generalization series. Routes rm's terminal output and
renderShareLinkRevokeOutputthrough the sharedrenderOperationhelper (#350), dropping the duplicatedcommandOutput(cmd).Render(..., newJSONCommandOperationOutput(cmd, ...))glue.Changes
cmd/rm.go— final render call usesrenderOperation.cmd/share_link_revoke.go—renderShareLinkRevokeOutputusesrenderOperation.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
renderOperationverbatim, preserving their internal branching —if !opts.dryRun && !opts.verbose { return nil }guard, thenrenderRemoveResultswhich prints "Would delete" vs "Deleted".if !input.DryRun { return nil }guard and per-URL loop.Only the envelope construction is shared. Output is unchanged in both modes.