Down_std.Tty
Terminal interaction.
val cap : cap
cap
is the current terminal capability. This only uses environment variables to detect it.
The type for ANSI colors.
type style = [
| `Bold
| `Faint
| `Italic
| `Underline
| `Reverse
| `Fg of [ color | `Hi of color ]
| `Bg of [ color | `Hi of color ]
]
The type for ANSI styles.
styled_str cap styles s
is s
styled according to cap
and styles
.
type input = [
| `Arrow of arrow
| `Backspace
| `Bytes of string
| `Ctrl of [ `Key of int | `Arrow of arrow ]
| `Delete
| `End
| `Enter
| `Escape
| `Function of int
| `Home
| `Meta of int
| `Page of [ `Up | `Down ]
| `Shift of [ `Arrow of arrow ]
| `Tab
| `Unknown of string
]
The type for user input.
val input : (unit -> int option) -> input option
input readc
is user input read byte-by-byte using readc
.
val pp_input : Stdlib.Format.formatter -> input -> unit
pp_input
formats inputs.
width readc
tries to termine the tty width using output
and readc
to read the result.