(ok: boolean, result?: string, seconds?: number)
| 82 | }; |
| 83 | |
| 84 | const endTool = (ok: boolean, result?: string, seconds?: number) => { |
| 85 | if (spinnerTimer) clearInterval(spinnerTimer); |
| 86 | spinnerTimer = undefined; |
| 87 | const mark = ok ? `${GREEN}✓${RESET}` : `${RED}✗ ${spinnerName}${RESET}`; |
| 88 | const took = seconds !== undefined ? `${DIM}${seconds.toFixed(1)}s${RESET} ` : ""; |
| 89 | out(`${CLEAR_LINE} ${mark} ${took}${DIM}${(result ?? "").slice(0, 88)}${RESET}\n`); |
| 90 | }; |
| 91 | |
| 92 | const handle = async (event: TheaterEvent): Promise<boolean> => { |
| 93 | switch (event.type) { |