Library
Module
Module type
Parameter
Class
Class type
Reads line intelligently.
The high level function that is the main API of the bestline library. This function checks if the terminal has basic capabilities, just checking for a blacklist of inarticulate terminals, and later either calls the line editing function or uses dummy fgets() so that you will be able to type something even in the most desperate of the conditions.
val bestline_raw :
string ->
Unix.file_descr ->
Unix.file_descr ->
string option
Reads line interactively.
This function can be used instead of bestline() in cases where we know for certain we're dealing with a terminal, which means we can avoid linking any stdio code.
Reads line intelligently w/ history, e.g.
(* see ~/.foo_history *) let () = let go () = match bestline_with_history("In> ", "foo") with | None -> () | Some line -> Printf.printf "OUT> %s\n" line; go () go ()
val clear_screen : Unix.file_descr -> unit
Clear the screen. Used to handle ctrl+l
Enables "mask mode".
When it is enabled, instead of the input that the user is typing, the terminal will just display a corresponding number of asterisks, like "****". This is useful for passwords and other secrets that should not be displayed.
@see bestlineMaskModeDisable()