Module B0.Tty

module Tty: sig .. end
ANSI terminal interaction.


Terminal kind and capabilities


type kind = 
| No_tty
| Dumb
| Term of string
The type for terminals.
val kind : out:Unix.file_descr -> kind
kind out determines the kind of terminal by consulting the TERM environment variable and using Unix.isatty on out's file descriptor.
type cap = 
| Ansi (*
ANSI terminal
*)
| None (*
No capability
*)
The type for terminal capabilities.
val cap : kind -> cap
cap kind determines capabilities according to kind.

ANSI escapes and styling


type color = [ `Black
| `Blue
| `Cyan
| `Default
| `Green
| `Magenta
| `Red
| `White
| `Yellow ]
The type for ANSI colors.
type style = [ `Bg of color
| `Blink of [ `Rapid | `Slow ]
| `Bold
| `Faint
| `Fg of color
| `Italic
| `Reverse
| `Underline ]
The type for ANSI styles.
val styled_str : cap -> style list -> string -> string
styled_str cap styles s styles s according to styles and cap.
val strip_escapes : string -> string
strip_escapes s removes ANSI escapes from s.