From 21bf5b776c749230675171af4977309f70dcaf36 Mon Sep 17 00:00:00 2001 From: Andrey Markelov Date: Thu, 9 Jul 2026 22:10:14 -0700 Subject: [PATCH] Migrate rm and share-link revoke dry-run to renderOperation 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). --- cmd/rm.go | 4 ++-- cmd/share_link_revoke.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/rm.go b/cmd/rm.go index d465255..7e9baff 100644 --- a/cmd/rm.go +++ b/cmd/rm.go @@ -76,12 +76,12 @@ func rm(cmd *cobra.Command, args []string) error { return err } - return commandOutput(cmd).Render(func(w io.Writer) error { + return renderOperation(cmd, nil, removeOperationResults(results), nil, func(w io.Writer) error { if !opts.dryRun && !opts.verbose { return nil } return renderRemoveResults(w, results) - }, newJSONCommandOperationOutput(cmd, nil, removeOperationResults(results), nil)) + }) } func removeOperationResults(results []removeResult) []jsonOperationResult { diff --git a/cmd/share_link_revoke.go b/cmd/share_link_revoke.go index 772253e..cac30ee 100644 --- a/cmd/share_link_revoke.go +++ b/cmd/share_link_revoke.go @@ -177,7 +177,7 @@ func revokeSharedLinksForPath(cmd *cobra.Command, path string, dryRun bool) ([]s } func renderShareLinkRevokeOutput(cmd *cobra.Command, input shareLinkRevokeInput, results []jsonOperationResult) error { - return commandOutput(cmd).Render(func(w io.Writer) error { + return renderOperation(cmd, input, results, nil, func(w io.Writer) error { if !input.DryRun { return nil } @@ -191,7 +191,7 @@ func renderShareLinkRevokeOutput(cmd *cobra.Command, input shareLinkRevokeInput, } } return nil - }, newJSONCommandOperationOutput(cmd, input, results, nil)) + }) } var shareLinkRevokeCmd = &cobra.Command{