withForcedAnsi<T> function

T withForcedAnsi<T>(
  1. T body()
)

Runs body with mason_logger's colour forced on, if the parent asked.

The whole of an entrypoint goes inside this rather than the colour being turned on somewhere: overrideAnsiOutput sets a zone value, a Progress frame is written from a timer, and a timer paints in the zone it was created in.

One function with two callers because a zone stops at an isolate boundary and revali dev crosses one. runRevali wraps the revali CLI; runConstruct wraps the constructs entrypoint that CLI starts with Isolate.spawnUri, which is where the status board, the key legend and the route table are actually printed. Wrapping only the first leaves all of that white, which is what it did.

Implementation

T withForcedAnsi<T>(T Function() body) =>
    ansiForcedByParent() ? overrideAnsiOutput(true, body) : body();