Console.Prompt
Create interactive prompts.
type item = private {
commands : Internal_pervasives.string Internal_pervasives.list;
description : Internal_pervasives.string;
details : Internal_pervasives.unit Fmt.t Internal_pervasives.option;
action : Base.Sexp.t Internal_pervasives.list ->
([ `Help | `Quit | `Loop ],
[ Internal_pervasives.System_error.t
| Internal_pervasives.Process_result.Error.t
| `Command_line of Internal_pervasives.string ])
Internal_pervasives.Asynchronous_result.t;
}
val item :
?details:Internal_pervasives.unit Fmt.t ->
description:Internal_pervasives.string ->
Internal_pervasives.string Internal_pervasives.list ->
(Base.Sexp.t Internal_pervasives.list ->
([ `Help | `Loop | `Quit ],
[ `Command_line of Internal_pervasives.string
| Internal_pervasives.System_error.t
| Internal_pervasives.Process_result.Error.t ])
Internal_pervasives.Asynchronous_result.t) ->
item
item description command_aliases action
creates a command which performs action
; action gets all the arguments parsed as S-Expressions.
val quit :
?description:Internal_pervasives.string ->
Internal_pervasives.string Internal_pervasives.list ->
item
val help :
?description:Internal_pervasives.string ->
Internal_pervasives.string Internal_pervasives.list ->
item
val unit_and_loop :
?details:Internal_pervasives.unit Fmt.t ->
description:Internal_pervasives.string ->
Internal_pervasives.string Internal_pervasives.list ->
(Base.Sexp.t Internal_pervasives.list ->
(Internal_pervasives.unit,
[ `Command_line of Internal_pervasives.string
| Internal_pervasives.Process_result.Error.t
| Internal_pervasives.System_error.t ])
Internal_pervasives.Asynchronous_result.t) ->
item
val default_commands :
Internal_pervasives.unit ->
item Internal_pervasives.list
val command :
?with_defaults:Internal_pervasives.bool ->
< application_name : Internal_pervasives.string ; console : t.. > ->
commands:item Internal_pervasives.list ->
(Internal_pervasives.unit, [> Internal_pervasives.System_error.t ])
Internal_pervasives.Asynchronous_result.t
Prompt for a command among ~commnands
.