package opam-core

  1. Overview
  2. Docs
Querying information
val visual_length : string -> int

Returns the length of the string in terminal chars, ignoring ANSI color sequences from OpamConsole.colorise

Text formatting functions
val cut_at_visual : string -> int -> string

Truncates the string to not visually get over width columns

val indent_left : string -> ?visual:string -> int -> string

left indenting. ~visual can be used to indent eg. ANSI colored strings and should correspond to the visible characters of s

val indent_right : string -> ?visual:string -> int -> string
val align_table : string list list -> string list list

Pads fields in a table with spaces for alignment.

val reformat : ?start_column:int -> ?indent:int -> ?width:int -> string -> string

Cut long lines in string according to the terminal width

val itemize : ?bullet:string -> ('a -> string) -> 'a list -> string

Convert a list of items to string as a dashed list

val pretty_list : ?last:string -> string list -> string

Display a pretty list: "x";"y";"z" -> "x, y and z". "and" can be changed by specifying last

Printing
val print_table : ?cut:[ `Wrap of string | `Truncate | `None ] -> Stdlib.out_channel -> sep:string -> string list list -> unit

Prints a table; generally called on tables passed through align_table. The default cut is to wrap on stdout, stderr, keep as-is otherwise. `Wrap sep prepends sep on wrapped lines

OCaml

Innovation. Community. Security.