({ args })
| 41 | }, |
| 42 | // fallow-ignore-next-line complexity |
| 43 | async run({ args }) { |
| 44 | if (args.confirm) { |
| 45 | // Don't auto-bypass the prompt just because stdin isn't a TTY |
| 46 | // or `--json` was passed — both used to silently skip the |
| 47 | // safety check. Force the caller to opt in via `--no-confirm` |
| 48 | // so cron jobs, CI shells, and JSON consumers can't soft-delete |
| 49 | // by accident. |
| 50 | if (args.json || !process.stdin.isTTY) { |
| 51 | errorBox( |
| 52 | "Confirmation required", |
| 53 | "delete cannot prompt for confirmation here — stdin isn't a TTY or --json was passed.", |
| 54 | "Re-run with --no-confirm to acknowledge the irreversible delete.", |
| 55 | ); |
| 56 | process.exit(1); |
| 57 | } |
| 58 | const ok = await confirmDelete(args.id); |
| 59 | if (!ok) { |
| 60 | // Distinct exit code so wrapper scripts can tell an explicit |
| 61 | // decline apart from an API/system error. |
| 62 | console.log(c.dim("Aborted.")); |
| 63 | process.exit(2); |
| 64 | } |
| 65 | } |
| 66 | const client = await createCloudClient(); |
| 67 | try { |
| 68 | const response = await client.deleteRender({ render_id: args.id }); |
| 69 | if (args.json) { |
| 70 | console.log( |
| 71 | JSON.stringify( |
| 72 | withMeta({ render: { render_id: response.render_id }, deleted: true }), |
| 73 | null, |
| 74 | 2, |
| 75 | ), |
| 76 | ); |
| 77 | return; |
| 78 | } |
| 79 | console.log(`${c.success("✓")} Deleted ${c.accent(response.render_id)}`); |
| 80 | } catch (err) { |
| 81 | reportApiError("Could not delete render", err, { |
| 82 | notFound: `No render found with id "${args.id}".`, |
| 83 | }); |
| 84 | } |
| 85 | }, |
| 86 | }); |
| 87 | |
| 88 | async function confirmDelete(id: string): Promise<boolean> { |
nothing calls this directly
no test coverage detected