Source

ocaml-core / base / core / extended / lib / ascii_table.mli

The branch 'bash' does not exist.
open Core.Std

module Align : sig
  type t
  val left : t
  val right : t
  val center : t
end

module Display : sig
  type t
  val short_box : t (* Default--cells can be multi-line. *)
  val tall_box : t (* Puts --- between entries. *)
  val line : t (* Trails off with ... if necessary. *)
end

module Column : sig
  type 'a t

  (** creates a column given the header and the to-string function *)
  val create:
    ?align : Align.t (* Default: left *)
    -> ?min_width : int
    -> ?max_width : int
    -> string
    -> ('a -> string)
    -> 'a t

  (** like create, except that the to_string function must provide a list of
      attributes. *)
  val create_attr:
    ?align : Align.t (* Default: left *)
    -> ?min_width : int
    -> ?max_width : int
    -> string
    -> ('a -> Console.Ansi.attr list * string)
    -> 'a t
end

type ('row, 'rest) renderer =
  ?display : Display.t (* Default: short_box *)
  -> ?spacing : int (* Default: 1 *)
  -> ?limit_width_to : int (* defaults to 90 characters *)
  -> ?header_attr : Console.Ansi.attr list
  -> 'row Column.t list
  -> 'row list
  -> 'rest

(** The idea is that you have a Column.t list and a list of rows, where each
    row contains the data for each column.  So e.g. 'a could be a record type
    {col_1 : int; col_2 : string}, where the first column pulls out col_1 and
    the second column pulls out col_2. **)
val output : (_, oc:Out_channel.t -> unit) renderer

val to_string_noattr : (_, string) renderer
val to_string : (_, string) renderer
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.