Module Cmdtui_lambda_term

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

val run_ui : prompt:string ‑> commands:('a ‑> 'a Lwt.t) Cmdtui.t ‑> 'a ‑> unit Lwt.t

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.

val run_script : prompt:string ‑> commands:('a ‑> 'a Lwt.t) Cmdtui.t ‑> 'a ‑> 'a Lwt.t

run_script ~prompt ~commands state is like run_lines but it reads the list of commands to execute from stdin

val run : prompt:string ‑> ('a ‑> 'a Lwt.t) Cmdtui.t ‑> 'a ‑> unit

run ~prompt commands state wraps run_ui with a basic Cmdliner interface, and sets up logging in debug mode.

This is for quickly testing your application.