package b0

  1. Overview
  2. Docs
Software construction and deployment kit

Install

Dune Dependency

Authors

Maintainers

Sources

b0-0.0.5.tbz
sha512=00a6868b4dfa34565d0141b335622a81a0e8d5b9e3c6dfad025dabfa3df2db2a1302b492953bbbce30c3a4406c324fcec25250a00b38f6d18a69e15605e3b07e

doc/b0.std/B0_std/Tty/index.html

Module B0_std.Tty

ANSI terminal interaction.

Terminals

type t = [ `Dumb | `Term of string ] option

The type for terminals. Either no terminal, a dumb one or a named terminal from the TERM environment variable.

val of_fd : Unix.file_descr -> t

of_fd fd determines the terminal for file descriptor fd by using Unix.isatty fd and consulting the TERM environment variable.

Capabilities

type cap = [
  1. | `None
    (*

    No capability.

    *)
  2. | `Ansi
    (*

    ANSI terminal.

    *)
]

The type for terminal capabilities. Either no capability or ANSI capability.

val cap : t -> cap

cap tty determines tty's capabilities.

ANSI escapes and styling

type color = [
  1. | `Default
  2. | `Black
  3. | `Red
  4. | `Green
  5. | `Yellow
  6. | `Blue
  7. | `Magenta
  8. | `Cyan
  9. | `White
]

The type for ANSI colors.

type style = [
  1. | `Bold
  2. | `Faint
  3. | `Italic
  4. | `Underline
  5. | `Reverse
  6. | `Fg of [ color | `Hi of color ]
  7. | `Bg of [ color | `Hi of color ]
]

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.

OCaml

Innovation. Community. Security.