package print-table

  1. Overview
  2. Docs

Source file print_table_ast.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
(****************************************************************************)
(*  print-table - Simple Unicode/ANSI and Markdown text table rendering     *)
(*  SPDX-FileCopyrightText: 2025 Mathieu Barbin <mathieu.barbin@gmail.com>  *)
(*  SPDX-License-Identifier: ISC                                            *)
(****************************************************************************)

module Style = struct
  type t =
    | Default
    | Fg_green
    | Fg_red
    | Fg_yellow
    | Dim
    | Underscore
end

module Cell = struct
  type t =
    { style : Style.t
    ; text : string
    }
end

module Align = struct
  type t =
    | Left
    | Center
    | Right
end

module Column = struct
  type 'a t =
    { header : string
    ; align : Align.t
    ; make_cell : 'a -> Cell.t
    }
end

type t =
  | T :
      { columns : 'a Column.t list
      ; rows : 'a list
      }
      -> t
OCaml

Innovation. Community. Security.