package lambda-term
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=adf27e37cb52c9461c718a66f7589103a77eccbcefdd95317545c0e9aee01200
md5=c13826a97014d4d573b927b623c7e043
doc/lambda-term/LTerm_read_line/index.html
Module LTerm_read_line
Interactive line input
For a complete example of usage of this module, look at the shell example (examples/shell.ml) distributed with Lambda-Term.
type prompt = LTerm_text.tType of prompts.
type history = Zed_utf8.t listType of histories. It is a list of entries from the most recent to the oldest.
Completion
val lookup : Zed_utf8.t -> Zed_utf8.t list -> Zed_utf8.t listlookup word words lookup for completion of word into words. It returns all words starting with word.
val lookup_assoc :
Zed_utf8.t ->
(Zed_utf8.t * 'a) list ->
(Zed_utf8.t * 'a) listlookup_assoc word words does the same as lookup but works on associative list.
Actions
type action = | Edit of LTerm_edit.action(*An edition action.
*)| Interrupt_or_delete_next_char(*Interrupt if at the beginning of an empty line, or delete the next character.
*)| Complete(*Complete current input.
*)| Complete_bar_next(*Go to the next possible completion in the completion bar.
*)| Complete_bar_prev(*Go to the previous possible completion in the completion bar.
*)| Complete_bar_first(*Goto the beginning of the completion bar.
*)| Complete_bar_last(*Goto the end of the completion bar.
*)| Complete_bar(*Complete current input using the completion bar.
*)| History_prev(*Go to the previous entry of the history.
*)| History_next(*Go to the next entry of the history.
*)| History_search_prev(*Search the previous entry of the history.
*)| History_search_next(*Search the next entry of the history.
*)| Accept(*Accept the current input.
*)| Clear_screen(*Clear the screen.
*)| Prev_search(*Search backward in the history.
*)| Next_search(*Search forward in the history.
*)| Cancel_search(*Cancel search mode.
*)| Break(*Raise
*)Sys.Break.| Suspend(*Suspend the program.
*)| Edit_with_external_editor(*Launch external editor.
*)
Type of actions.
val bindings : action list Zed_input.Make(LTerm_key).t refBindings.
val bind : LTerm_key.t list -> action list -> unitbind seq actions associates actions to the given sequence.
val unbind : LTerm_key.t list -> unitunbind seq unbinds seq.
val doc_of_action : action -> stringdoc_of_action action returns a short description of the action.
val action_of_name : string -> actionaction_of_name str converts the given action name into an action. Action name are the same as variants name but lowercased and with '_' replaced by '-'. It raises Not_found if the name does not correspond to an action. It also recognizes edition actions.
val name_of_action : action -> stringname_of_action act returns the name of the given action.
The read-line engine
val macro : action Zed_macro.tThe global macro recorder.
class virtual 'a engine : ?history:history -> ?clipboard:Zed_edit.clipboard -> ?macro:action
Zed_macro.t ->
unit -> object ... endThe read-line engine. If no clipboard is provided, LTerm_edit.clipboard is used. If no macro recorder is provided, macro is used.
Predefined classes
Simple read-line engine which returns the result as a string.
class read_password : unit -> object ... endRead-line engine for reading a password. The stylise method default to replacing all characters by '*'. You can also for example completely disable displaying the password by doing:
type 'a read_keyword_result = | Rk_value of 'a(*The user typed a correct keyword and this is its associated value.
*)| Rk_error of Zed_utf8.t(*The user did not enter a correct keyword and this is what he typed instead.
*)
The result of reading a keyword.
class 'a read_keyword : ?history:history -> unit -> object ... endRead a keyword.