Version last
This is a preliminary version of the documentation. Help us to improve it by filling tickets. We are looking for native english speakers to proof read the documentation. Contact us!
module Lwt_read_line:Interactive line inputsig..end
exception Interrupt
Ctrl^Dtypeedition_state =Text.t * Text.t
typeprompt =Lwt_term.styled_text
typetext_set =Set.Make(Text).t
type completion_result = { | comp_state : | (* | The new edition state | *) |
| comp_words : | (* | A list of possibilities | *) |
typecompletion =edition_state -> completion_result Lwt.t
Note: the thread launched by the completion function is cancelled using Lwt.cancel if the user continue typing text.
val lookup : Text.t -> text_set -> Text.t * text_setlookup word words lookup for completion of word into words. It returns (prefix, possibilities) where possibilities are all words starting with word and prefix is the longest common prefix of possibilities.val complete : ?suffix:Text.t ->
Text.t ->
Text.t -> Text.t -> text_set -> completion_resultcomplete ?suffix before word after words basic completion functions. words is a list of possible completions for word. If completion succeed suffix is append to the resulting text. It defaults to " ".
val print_words : Lwt_text.output_channel -> int -> string list -> unit Lwt.tprint_words oc columns strs pretty-prints a list of words.typehistory =Text.t list
val add_entry : Text.t -> history -> historyadd_entry line history returns the history history plus line at the beginning. If line already appears at the beginning or contains only spaces, it is discarded.val save_history : string -> history -> unit Lwt.tsave_history filename history saves history to filename. History is saved by separating lines with a null character.val load_history : string -> history Lwt.tload_history filename loads history from filename. Returns the empty history if the the file does not exit.class clipboard :object..end
val clipboard : clipboardtypecompletion_mode =[ `classic | `none | `real_time ]
`classic means that when the user hit Tab a list of possible completions is proposed,`real_time means that possible completions are shown to the user as he types, and he can navigate in them with Meta+left, Meta+right`none means no completion at allval read_line : ?history:history ->
?complete:completion ->
?clipboard:clipboard ->
?mode:completion_mode ->
?prompt:prompt -> unit -> Text.t Lwt.treadline ?history ?complete ?mode ?prompt () inputs some text from the user. If input is not a terminal, it defaults to Lwt_text.read_line Lwt_text.stdin. If
mode : contains the current completion mode. It defaults to `real_time.prompt : defaults to Lwt_term.Text "# "typepassword_style =[ `clear | `empty | `text of Text.t ]
`empty nothing is printed`clear the password is displayed has it`text ch all characters are replaced by chval read_password : ?clipboard:clipboard ->
?style:password_style ->
?prompt:prompt -> unit -> Text.t Lwt.tread_password ?clipboard ?clear ~prompt () inputs a password from the user. This function fails if input is not a terminal.style : defaults to `text "*".val read_keyword : ?history:history ->
?case_sensitive:bool ->
?mode:completion_mode ->
?prompt:prompt -> values:(Text.t * 'a) list -> unit -> 'a Lwt.tread_keyword ?history ?case_sensitive ?mode ~prompt ~keywords () reads one word which is a member of words. And returns which keyword the user choosed. case_sensitive default to false.
val read_yes_no : ?history:history ->
?mode:completion_mode ->
?prompt:prompt -> unit -> bool Lwt.tread_yes_no ?history ?dynamic prompt () is the same as:
read_keyword ?history ?dynamic prompt [("yes", true); ("no", false)] () module Command:sig..end
module Engine:sig..end
module Terminal:sig..end
module Control:sig..end