The calm reporter (commons headless 0004-headless-cliFR-003, FR-005, FR-007): what a command tells while it runs, drawn as a person wants to read it. Quiet on success and loud on a problem: a line for a phase only when it has something to see (a green step line is for --verbose), every item only with --verbose, the problems kept for the closing block, and the whole run, every item and every problem, in the run's log whatever the mode. On a terminal a phase in progress is one line redrawn in place (a spinner, a progress bar, what it is doing now); anywhere else there are only the final lines, with no control character in them.
import { Reporter } from"./reporter.ts";
constwritten:string[] = [];
constr=newReporter({ look: { tty: false, colour: false, emoji: false, columns: 80 }, verbosity: "calm", write: (t) => written.push(t), now: () =>0 });
r.progress({ kind: "phase", name: "Packages" });
r.progress({ kind: "done", result: "86 installed" });
r.close();
written.join(""); // "": a phase that went well is no line in calm
typeReporterOptions= {
readonlylook:Look;
readonlyverbosity:Verbosity;
/** Where the screen text goes (the error stream). */readonlywrite: (text:string) =>void;
readonlynow: () =>number;
readonlylog?:RunLog;
/** Redraws the line in progress; used only on a terminal. */readonlytimer?:TimerPort;
/** What watches the run. */readonlyevents?:RunEvents;
};