2016-09-08 21:13:10 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* Copyright (c) 2014 - 2016. *)
|
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
|
|
|
(* Tezos: a small Command Line Parsing library *)
|
|
|
|
(* Only used in the client. *)
|
|
|
|
|
|
|
|
exception Command_not_found
|
|
|
|
exception Bad_argument of int * string * string
|
|
|
|
exception Command_failed of string
|
|
|
|
|
2016-11-22 17:23:40 +04:00
|
|
|
type 'a params
|
|
|
|
type command
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
and desc = string
|
|
|
|
and group = string
|
|
|
|
and tag = string
|
|
|
|
|
|
|
|
val param:
|
|
|
|
name: string ->
|
|
|
|
desc: string ->
|
|
|
|
(string -> 'a Lwt.t) -> 'b params -> ('a -> 'b) params
|
|
|
|
val prefix: string -> 'a params -> 'a params
|
|
|
|
val prefixes: string list -> 'a params -> 'a params
|
|
|
|
val string: string -> string -> 'a params -> (string -> 'a) params
|
|
|
|
val fixed: string list -> (unit -> unit Lwt.t) params
|
|
|
|
val stop: (unit -> unit Lwt.t) params
|
|
|
|
val seq:
|
|
|
|
name: string ->
|
|
|
|
desc: string ->
|
2016-11-22 17:23:40 +04:00
|
|
|
(string -> 'p Lwt.t) ->
|
|
|
|
('p list -> unit -> unit Lwt.t) params
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val seq_of_param:
|
2016-11-22 17:23:40 +04:00
|
|
|
((unit -> unit Lwt.t) params ->
|
|
|
|
('a -> unit -> unit Lwt.t) params) ->
|
|
|
|
('a list -> unit -> unit Lwt.t) params
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val command:
|
|
|
|
?desc:desc ->
|
|
|
|
?tags:tag list ->
|
|
|
|
?group:group ->
|
|
|
|
?args:(Arg.key * Arg.spec * Arg.doc) list ->
|
|
|
|
'a params -> 'a -> command
|
|
|
|
|
|
|
|
val register_group: group -> group -> unit
|
|
|
|
val register_tag: tag -> string -> unit
|
|
|
|
|
|
|
|
val usage:
|
|
|
|
command list -> (string * Arg.spec * string) list -> string
|
2016-11-22 17:23:40 +04:00
|
|
|
val inline_dispatch:
|
2016-12-02 02:20:23 +04:00
|
|
|
command list -> unit ->
|
|
|
|
[ `Arg of string | `End ] ->
|
|
|
|
[ `Args of (Arg.key * Arg.spec * Arg.doc) list
|
2016-09-08 21:13:10 +04:00
|
|
|
| `Fail of exn
|
|
|
|
| `Nop
|
2016-12-02 02:20:23 +04:00
|
|
|
| `Res of unit -> unit Lwt.t ]
|
2016-11-22 17:23:40 +04:00
|
|
|
|
|
|
|
val dispatch:
|
|
|
|
command list -> unit -> string list -> unit Lwt.t
|
|
|
|
|
|
|
|
val log_hook : (string -> string -> unit Lwt.t) option ref
|
|
|
|
|
|
|
|
val error : ('a, Format.formatter, unit, 'b Lwt.t) format4 -> 'a
|
2016-11-22 20:24:52 +04:00
|
|
|
val warning : ('a, Format.formatter, unit, unit Lwt.t) format4 -> 'a
|
2016-11-22 17:23:40 +04:00
|
|
|
val message : ('a, Format.formatter, unit, unit Lwt.t) format4 -> 'a
|
|
|
|
val answer : ('a, Format.formatter, unit, unit Lwt.t) format4 -> 'a
|
|
|
|
val log : string -> ('a, Format.formatter, unit, unit Lwt.t) format4 -> 'a
|