Library
Module
Module type
Parameter
Class
Class type
lambda_term
support
Defines an application that has commands of form 'a -> 'a Lwt.t
, meaning that they take an application state 'a
, perform some processing and return the new state 'a
.
val show_bindings : 'a -> 'a Lwt.t
showbindings state
will print all currently registered key bindings. state
is passed through unchanged
val display_help : (string * string) list -> 'a -> 'a Lwt.t
display_help commands state
prints formatted help message from commands
. state
is passed through unchanged. Can be used as the ~help
parameter of Cmdtui.commands
run_ui ~prompt ~commands state
will run the user interface with initial state state
. It will display the prompt
and wait f or one of the commands
, displaying completion and type hints interactively. When enter is pressed the command is executed or an error message printed.
val run_lines :
prompt:string ->
commands:('a -> 'a Lwt.t) Cmdtui.t ->
'a ->
string Lwt_stream.t ->
'a Lwt.t
run_lines ~prompt ~commands state lines
is like run_ui
but non-interactive: it executes the commands from lines
.
run_script ~prompt ~commands state
is like run_lines
but it reads the list of commands to execute from stdin