package matrix

  1. Overview
  2. Docs

Module Matrix_cli.ProgressSource

How a program's progress shows on a destination.

A program's progress is what it shows of its work while it works. On a destination it shows in one mode (Progress.t): rows redrawn in place (`Tty), lines printed as the work goes (`Plain), only what fails (`Quiet), or one JSON event a line for another program to read (`Json). A --progress option chooses a mode or `Auto, and Progress.decide gives a destination its mode for that choice, as Ansi.Styling.decide gives it a styling for --color.

Sourcetype choice = [
  1. | `Auto
  2. | `Tty
  3. | `Plain
  4. | `Quiet
  5. | `Json
]

The type for a program's choices.

Sourcetype t = [
  1. | `Tty
  2. | `Plain
  3. | `Quiet
  4. | `Json
]

The type for modes.

Sourceval choices : (string * choice) list

choices is the choices as a --progress option names them, auto, tty, plain, quiet and json, in that order, as Cmdliner.Arg.enum takes them.

Sourceval decide : ?progress:choice -> (string -> string option) -> tty:bool -> dumb:bool -> t

decide ~progress getenv ~tty ~dumb is the mode of a destination, which is a terminal iff tty and a dumb one iff dumb, for the program's choice progress (`Auto by default), reading the environment with getenv. `Auto is `Tty on a terminal that is not dumb outside a continuous integration job, and `Plain elsewhere. A job keeps its output as a log that replays line by line, where redrawn rows pile up, and the process is in one when CI is set to anything but the empty string, 0 or false. cargo counts any value. `Tty is `Tty on a terminal that is not dumb, in such a job too, and `Plain elsewhere, since rows are redrawn with the cursor motions only a terminal performs. The other choices are their modes.