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 (already reformats supposes no additional left margin: don't use within OpamConsole.error or similar)

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

val as_aligned_table : ?width:int -> string list -> string list list

Splits a list of strings so that it can be printed as a table that should fit on screen

OCaml

Innovation. Community. Security.