OCaml port of Linenoise
1(** {! Bruit} is a port of the C library
2 {{:https://github.com/antirez/linenoise} Linenoise} to OCaml. It is not as
3 feature complete as the library, contributions are very welcome.
4
5 The main entry point to the library is {! bruit}. *)
6
7type history = string -> string list
8(** The history callback that provides the user with the current line and
9 expects a list of history items to scroll through using the arrow keys. *)
10
11type hint = string -> (string * Fmt.style) option
12(** The hint callback takes the current input and a user can return, optionally,
13 extra information to fill in on the current line. *)
14
15type result = String of string option | Ctrl_c
16
17val bruit :
18 ?complete:(string -> string list) ->
19 ?history:history ->
20 ?hint:hint ->
21 string ->
22 result
23(** [bruit ?complete prompt] reads from [stdin] and returns the read string if
24 any, and on [ctrl+c] returns {! Ctrl_c}.
25
26 @param complete Used for completions, defaults to [None]. *)