package matrix

Build not yet checked
  1. Overview
  2. Docs
Fast, modern terminal toolkit for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

mosaic-0.3.0.tbz
sha256=a92cbbcbe016fb19fb0a749222da0e459a9567aef3f4c7340d9bd6b71c53ed6f
sha512=6a7ab054605538bb31a2b73a1a6d093981a2704c9f0af5852221c05735290d74aca7c7282298c4d0f91e86a800e2ccd94b4918af883cd963449c758eb6b272b3

doc/matrix_cli_unix/Matrix_cli_unix/Task/index.html

Module Matrix_cli_unix.TaskSource

Tasks.

Sourcetype t

The type for tasks, the root among them.

Sourcetype status = [
  1. | `Running
  2. | `Succeeded
  3. | `Failed
  4. | `Cancelled
]

The type for where a task is: running or how it ended.

Sourceval start : ?transient:bool -> ?lines:int -> t -> string -> t

start ~transient ~lines parent label is a task named label, started under parent, transient iff transient (false by default), whose window shows its latest lines lines of output (8 by default). A task started under one that ended is cancelled at once and prints nothing.

Raises Invalid_argument if lines is negative.

Sourceval run : ?transient:bool -> ?lines:int -> t -> string -> (t -> 'a) -> 'a

run ~transient ~lines parent label f is f t for the task t that start starts. t succeeds when f returns and fails when f raises, with the exception as its message, which is raised again. An ending f gave t counts.

Sourceval items : t -> ?total:int -> int -> unit

items t ~total n says that t has done n items, out of total when given. Its rate is the count a second, weighing the past by exp (-. dt /. 2.) for dt seconds ago, and a count below the last starts it again.

Raises Invalid_argument if n or total is negative.

Sourceval bytes : t -> ?total:int -> int -> unit

bytes is items for a task that counts bytes.

Sourceval rename : t -> string -> unit

rename t label makes label t's label.

Sourceval log : t -> string -> unit

log t text gives t each line of text as its output.

Sourceval succeed : ?message:string -> t -> unit

succeed ~message t ends t as a success, message after its label. The tasks under t that still run end first, and succeed with it.

Sourceval fail : ?message:string -> t -> unit

fail ~message t ends t as a failure, message after its label. The tasks under t that still run are cancelled first.

Sourceval cancel : ?message:string -> t -> unit

cancel ~message t ends t as cancelled, message after its label. The tasks under t that still run are cancelled first.

Sourcetype state = {
  1. label : string;
  2. status : status;
  3. message : string option;
    (*

    The message it ended with.

    *)
  4. count : int;
    (*

    0 until it is counted.

    *)
  5. total : int option;
  6. unit : [ `Items | `Bytes ];
    (*

    What it counts.

    *)
  7. elapsed : float;
    (*

    Seconds since it started, up to its end.

    *)
  8. rate : float option;
    (*

    Its count a second, once it has one.

    *)
  9. output : string list;
    (*

    Its lines of output, oldest first.

    *)
  10. children : t list;
    (*

    The tasks started under it, oldest first.

    *)
}

The type for what a task is, at a time.

Sourceval state : t -> state

state t is t as it is now.

Sourceval rows : t -> width:int -> height:int -> Matrix_grid.t

rows t ~width ~height is the rows of the running tasks under t, and the summary under them if t is the root, width cells wide, as `Tty draws them, for a frame of tasks to show with other grids. A task's row is its mark, its label, a bar when it has a total, its message, its count, its rate when it counts bytes, and its time, each in a column as wide as its widest cell. Rows taller than height give way: first the tasks that ended under each running task fold into one line, such as 10 done, 2 failed, then the windows shrink.