Base: rename Cli_entries into Clic

This commit is contained in:
Grégoire Henry 2018-04-03 11:39:09 +02:00
parent 4ad127c398
commit 08a3cff5a6
47 changed files with 230 additions and 187 deletions

View File

@ -279,36 +279,36 @@ opam:08:tezos-micheline:
variables: variables:
package: tezos-micheline package: tezos-micheline
opam:09:tezos-protocol-environment-sigs: opam:09:tezos-rpc:
<<: *opam_definition
variables:
package: tezos-protocol-environment-sigs
opam:10:tezos-rpc:
<<: *opam_definition <<: *opam_definition
variables: variables:
package: tezos-rpc package: tezos-rpc
opam:11:tezos-base: opam:10:tezos-base:
<<: *opam_definition <<: *opam_definition
variables: variables:
package: tezos-base package: tezos-base
opam:12:pbkdf: opam:11:pbkdf:
<<: *opam_definition <<: *opam_definition
variables: variables:
package: pbkdf package: pbkdf
opam:13:ocplib-resto-cohttp: opam:12:ocplib-resto-cohttp:
<<: *opam_definition <<: *opam_definition
variables: variables:
package: ocplib-resto-cohttp package: ocplib-resto-cohttp
opam:14:irmin-leveldb: opam:13:irmin-leveldb:
<<: *opam_definition <<: *opam_definition
variables: variables:
package: irmin-leveldb package: irmin-leveldb
opam:14:tezos-protocol-environment-sigs:
<<: *opam_definition
variables:
package: tezos-protocol-environment-sigs
opam:15:tezos-stdlib-unix: opam:15:tezos-stdlib-unix:
<<: *opam_definition <<: *opam_definition
variables: variables:
@ -364,105 +364,110 @@ opam:25:tezos-client-commands:
variables: variables:
package: tezos-client-commands package: tezos-client-commands
opam:26:tezos-baking-alpha: opam:26:tezos-protocol-environment-shell:
<<: *opam_definition
variables:
package: tezos-protocol-environment-shell
opam:27:tezos-baking-alpha:
<<: *opam_definition <<: *opam_definition
variables: variables:
package: tezos-baking-alpha package: tezos-baking-alpha
opam:27:tezos-protocol-genesis: opam:28:tezos-protocol-genesis:
<<: *opam_definition <<: *opam_definition
variables: variables:
package: tezos-protocol-genesis package: tezos-protocol-genesis
opam:28:tezos-protocol-updater: opam:29:ocplib-resto-json:
<<: *opam_definition
variables:
package: tezos-protocol-updater
opam:29:tezos-p2p:
<<: *opam_definition
variables:
package: tezos-p2p
opam:30:ocplib-resto-json:
<<: *opam_definition <<: *opam_definition
variables: variables:
package: ocplib-resto-json package: ocplib-resto-json
opam:31:tezos-baking-alpha-commands: opam:30:tezos-protocol-updater:
<<: *opam_definition
variables:
package: tezos-protocol-updater
opam:31:tezos-p2p:
<<: *opam_definition
variables:
package: tezos-p2p
opam:32:tezos-baking-alpha-commands:
<<: *opam_definition <<: *opam_definition
variables: variables:
package: tezos-baking-alpha-commands package: tezos-baking-alpha-commands
opam:32:tezos-client-alpha-commands: opam:33:tezos-client-alpha-commands:
<<: *opam_definition <<: *opam_definition
variables: variables:
package: tezos-client-alpha-commands package: tezos-client-alpha-commands
opam:33:tezos-client-base-unix: opam:34:tezos-client-base-unix:
<<: *opam_definition <<: *opam_definition
variables: variables:
package: tezos-client-base-unix package: tezos-client-base-unix
opam:34:tezos-client-genesis: opam:35:tezos-client-genesis:
<<: *opam_definition <<: *opam_definition
variables: variables:
package: tezos-client-genesis package: tezos-client-genesis
opam:35:tezos-embedded-protocol-alpha: opam:36:ocplib-ezresto:
<<: *opam_definition
variables:
package: tezos-embedded-protocol-alpha
opam:36:tezos-embedded-protocol-demo:
<<: *opam_definition
variables:
package: tezos-embedded-protocol-demo
opam:37:tezos-embedded-protocol-genesis:
<<: *opam_definition
variables:
package: tezos-embedded-protocol-genesis
opam:38:tezos-shell:
<<: *opam_definition
variables:
package: tezos-shell
opam:39:ocplib-ezresto:
<<: *opam_definition <<: *opam_definition
variables: variables:
package: ocplib-ezresto package: ocplib-ezresto
opam:40:tezos-client: opam:37:tezos-embedded-protocol-alpha:
<<: *opam_definition
variables:
package: tezos-embedded-protocol-alpha
opam:38:tezos-embedded-protocol-demo:
<<: *opam_definition
variables:
package: tezos-embedded-protocol-demo
opam:39:tezos-embedded-protocol-genesis:
<<: *opam_definition
variables:
package: tezos-embedded-protocol-genesis
opam:40:tezos-shell:
<<: *opam_definition
variables:
package: tezos-shell
opam:41:tezos-client:
<<: *opam_definition <<: *opam_definition
variables: variables:
package: tezos-client package: tezos-client
opam:41:tezos-node:
<<: *opam_definition
variables:
package: tezos-node
opam:42:ocplib-ezresto-directory: opam:42:ocplib-ezresto-directory:
<<: *opam_definition <<: *opam_definition
variables: variables:
package: ocplib-ezresto-directory package: ocplib-ezresto-directory
opam:43:tezos-baker-alpha: opam:43:tezos-clic:
<<: *opam_definition
variables:
package: tezos-clic
opam:44:tezos-baker-alpha:
<<: *opam_definition <<: *opam_definition
variables: variables:
package: tezos-baker-alpha package: tezos-baker-alpha
opam:44:tezos-protocol-demo: opam:45:tezos-protocol-demo:
<<: *opam_definition <<: *opam_definition
variables: variables:
package: tezos-protocol-demo package: tezos-protocol-demo
opam:45:tezos-protocol-environment-shell: opam:46:tezos-node:
<<: *opam_definition <<: *opam_definition
variables: variables:
package: tezos-protocol-environment-shell package: tezos-node
##END_OPAM## ##END_OPAM##

View File

@ -8,11 +8,11 @@
(**************************************************************************) (**************************************************************************)
let group = let group =
{ Cli_entries.name = "protocols" ; { Clic.name = "protocols" ;
title = "Commands for managing protocols" } title = "Commands for managing protocols" }
let commands () = let commands () =
let open Cli_entries in let open Clic in
let check_dir _ dn = let check_dir _ dn =
if Sys.is_directory dn then if Sys.is_directory dn then
return dn return dn

View File

@ -10,7 +10,7 @@
(* Tezos Command line interface - Generic JSON RPC interface *) (* Tezos Command line interface - Generic JSON RPC interface *)
open Lwt.Infix open Lwt.Infix
open Cli_entries open Clic
open Json_schema open Json_schema
(*-- Assisted, schema directed input fill in --------------------------------*) (*-- Assisted, schema directed input fill in --------------------------------*)
@ -424,7 +424,7 @@ let call_with_file_or_json url maybe_file (cctxt: #Client_context.full) =
call_with_json url json cctxt call_with_json url json cctxt
let group = let group =
{ Cli_entries.name = "rpc" ; { Clic.name = "rpc" ;
title = "Commands for the low level RPC layer" } title = "Commands for the low level RPC layer" }
let commands = [ let commands = [

View File

@ -51,9 +51,9 @@ module Extend(H : Tezos_crypto.S.HASH) = struct
() ()
let param ?(name=H.name) ?(desc=H.title) t = let param ?(name=H.name) ?(desc=H.title) t =
Cli_entries.param Clic.param
~name ~name
~desc (Cli_entries.parameter (fun _ str -> Lwt.return (of_b58check str))) t ~desc (Clic.parameter (fun _ str -> Lwt.return (of_b58check str))) t
module Set = struct module Set = struct
include Set.Make(struct type nonrec t = t let compare = compare end) include Set.Make(struct type nonrec t = t let compare = compare end)

View File

@ -31,7 +31,7 @@ module Public_key = struct
let param let param
?(name="ed25519-public") ?(name="ed25519-public")
?(desc="Ed25519 public key (b58check-encoded)") t = ?(desc="Ed25519 public key (b58check-encoded)") t =
Cli_entries.(param ~name ~desc Clic.(param ~name ~desc
(parameter (fun _ str -> Lwt.return (of_b58check str))) t) (parameter (fun _ str -> Lwt.return (of_b58check str))) t)
end end
@ -66,7 +66,7 @@ module Secret_key = struct
let param let param
?(name="ed25519-secret") ?(name="ed25519-secret")
?(desc="Ed25519 secret key (b58check-encoded)") t = ?(desc="Ed25519 secret key (b58check-encoded)") t =
Cli_entries.(param ~name ~desc Clic.(param ~name ~desc
(parameter (fun _ str -> Lwt.return (of_b58check str))) t) (parameter (fun _ str -> Lwt.return (of_b58check str))) t)
end end
@ -100,7 +100,7 @@ module Signature = struct
let param let param
?(name="ed25519-signature") ?(name="ed25519-signature")
?(desc="Ed25519 signature (b58check-encoded)") t = ?(desc="Ed25519 signature (b58check-encoded)") t =
Cli_entries.(param ~name ~desc Clic.(param ~name ~desc
(parameter (fun _ str -> Lwt.return (of_b58check str))) t) (parameter (fun _ str -> Lwt.return (of_b58check str))) t)
end end

View File

@ -10,8 +10,8 @@ module Public_key : sig
val param: val param:
?name:string -> ?name:string ->
?desc:string -> ?desc:string ->
('a, 'b) Cli_entries.params -> ('a, 'b) Clic.params ->
(t -> 'a, 'b) Cli_entries.params (t -> 'a, 'b) Clic.params
val of_b58check: string -> t tzresult val of_b58check: string -> t tzresult
end end
@ -21,8 +21,8 @@ module Secret_key : sig
val param: val param:
?name:string -> ?name:string ->
?desc:string -> ?desc:string ->
('a, 'b) Cli_entries.params -> ('a, 'b) Clic.params ->
(t -> 'a, 'b) Cli_entries.params (t -> 'a, 'b) Clic.params
val of_b58check: string -> t tzresult val of_b58check: string -> t tzresult
end end
@ -32,8 +32,8 @@ module Signature : sig
val param: val param:
?name:string -> ?name:string ->
?desc:string -> ?desc:string ->
('a, 'b) Cli_entries.params -> ('a, 'b) Clic.params ->
(t -> 'a, 'b) Cli_entries.params (t -> 'a, 'b) Clic.params
val of_b58check: string -> t tzresult val of_b58check: string -> t tzresult
end end

View File

@ -9,6 +9,7 @@
-open Tezos_data_encoding -open Tezos_data_encoding
-open Tezos_error_monad -open Tezos_error_monad
-open Tezos_rpc -open Tezos_rpc
-open Tezos_clic
-open Tezos_micheline -open Tezos_micheline
-safe-string)) -safe-string))
(libraries (tezos-stdlib (libraries (tezos-stdlib
@ -16,6 +17,7 @@
tezos-data-encoding tezos-data-encoding
tezos-error-monad tezos-error-monad
tezos-rpc tezos-rpc
tezos-clic
tezos-micheline tezos-micheline
re.str re.str
calendar calendar

View File

@ -146,8 +146,8 @@ module type INTERNAL_HASH = sig
val param: val param:
?name:string -> ?name:string ->
?desc:string -> ?desc:string ->
('a, 'arg) Cli_entries.params -> ('a, 'arg) Clic.params ->
(t -> 'a, 'arg) Cli_entries.params (t -> 'a, 'arg) Clic.params
module Set : sig module Set : sig
include Set.S with type elt = t include Set.S with type elt = t
@ -196,8 +196,8 @@ module type INTERNAL_MERKLE_TREE = sig
val param: val param:
?name:string -> ?name:string ->
?desc:string -> ?desc:string ->
('a, 'arg) Cli_entries.params -> ('a, 'arg) Clic.params ->
(t -> 'a, 'arg) Cli_entries.params (t -> 'a, 'arg) Clic.params
module Set : sig module Set : sig
include Set.S with type elt = t include Set.S with type elt = t

View File

@ -11,6 +11,7 @@ include Tezos_stdlib
include Tezos_data_encoding include Tezos_data_encoding
include Tezos_error_monad include Tezos_error_monad
include Tezos_rpc include Tezos_rpc
include Tezos_clic
include Tezos_micheline include Tezos_micheline
module Ed25519 = Ed25519 module Ed25519 = Ed25519
@ -55,7 +56,6 @@ module P2p_connection = P2p_connection
module P2p_stat = P2p_stat module P2p_stat = P2p_stat
module P2p_version = P2p_version module P2p_version = P2p_version
module Cli_entries = Cli_entries
module Lwt_exit = Lwt_exit module Lwt_exit = Lwt_exit
include Utils.Infix include Utils.Infix

View File

@ -11,6 +11,7 @@ include (module type of (struct include Tezos_stdlib end))
include (module type of (struct include Tezos_data_encoding end)) include (module type of (struct include Tezos_data_encoding end))
include (module type of (struct include Tezos_error_monad end)) include (module type of (struct include Tezos_error_monad end))
include (module type of (struct include Tezos_rpc end)) include (module type of (struct include Tezos_rpc end))
include (module type of (struct include Tezos_clic end))
module Ed25519 = Ed25519 module Ed25519 = Ed25519
module Crypto_box = Crypto_box module Crypto_box = Crypto_box
@ -52,7 +53,6 @@ module P2p_connection = P2p_connection
module P2p_stat = P2p_stat module P2p_stat = P2p_stat
module P2p_version = P2p_version module P2p_version = P2p_version
module Cli_entries = Cli_entries
module Lwt_exit = Lwt_exit module Lwt_exit = Lwt_exit
include (module type of (struct include Utils.Infix end)) include (module type of (struct include Utils.Infix end))

View File

@ -260,7 +260,7 @@ let group_commands commands =
let ({ title ; _ }, r) = let ({ title ; _ }, r) =
List.find (fun ({ name ; _ }, _) -> group.name = name) grouped in List.find (fun ({ name ; _ }, _) -> group.name = name) grouped in
if title <> group.title then if title <> group.title then
invalid_arg "Cli_entries.usage: duplicate group name" ; invalid_arg "Clic.usage: duplicate group name" ;
r := command :: !r ; r := command :: !r ;
(grouped, ungrouped) (grouped, ungrouped)
with Not_found -> with Not_found ->
@ -315,7 +315,7 @@ let setup_formatter ppf format verbosity =
let pop_level () = let pop_level () =
match !levels with match !levels with
| _ :: level :: rest -> levels := level :: rest ; setup_level level | _ :: level :: rest -> levels := level :: rest ; setup_level level
| [ _ ] | [] -> Pervasives.failwith "Cli_entries: unclosed verbosity tag" in | [ _ ] | [] -> Pervasives.failwith "Clic: unclosed verbosity tag" in
push_level (Terse, (<=)) ; push_level (Terse, (<=)) ;
let push_level_tag tag = let push_level_tag tag =
let push op = function let push op = function
@ -323,7 +323,7 @@ let setup_formatter ppf format verbosity =
| "details" -> push_level (Details, op) | "details" -> push_level (Details, op)
| "short" -> push_level (Short, op) | "short" -> push_level (Short, op)
| "terse" -> push_level (Terse, op) | "terse" -> push_level (Terse, op)
| tag -> Pervasives.failwith ("Cli_entries: invalid semantic tag <" ^ tag ^ ">") in | tag -> Pervasives.failwith ("Clic: invalid semantic tag <" ^ tag ^ ">") in
if String.length tag > 0 && String.get tag 0 = '=' then if String.length tag > 0 && String.get tag 0 = '=' then
push (=) (String.sub tag 1 (String.length tag - 1)) push (=) (String.sub tag 1 (String.length tag - 1))
else if String.length tag > 0 && String.get tag 0 = '-' then else if String.length tag > 0 && String.get tag 0 = '-' then
@ -333,7 +333,7 @@ let setup_formatter ppf format verbosity =
| "full" | "details" | "short" | "terse" | "full" | "details" | "short" | "terse"
| "-full" | "-details" | "-short" | "-terse" | "-full" | "-details" | "-short" | "-terse"
| "=full" | "=details" | "=short" | "=terse" -> pop_level () | "=full" | "=details" | "=short" | "=terse" -> pop_level ()
| tag -> Pervasives.failwith ("Cli_entries: invalid semantic tag <" ^ tag ^ ">") in | tag -> Pervasives.failwith ("Clic: invalid semantic tag <" ^ tag ^ ">") in
match format with match format with
| Ansi -> | Ansi ->
let color_num = function let color_num = function
@ -373,7 +373,7 @@ let setup_formatter ppf format verbosity =
| _ :: format :: rest -> | _ :: format :: rest ->
ansi_stack := format :: rest ; ansi_stack := format :: rest ;
Format.fprintf ppf "@<0>%a" ansi_format format Format.fprintf ppf "@<0>%a" ansi_format format
| [ _ ] | [] -> Pervasives.failwith "Cli_entries: unclosed ansi format" in | [ _ ] | [] -> Pervasives.failwith "Clic: unclosed ansi format" in
Format.pp_set_formatter_tag_functions ppf Format.pp_set_formatter_tag_functions ppf
{ mark_open_tag = (fun _ -> "") ; { mark_open_tag = (fun _ -> "") ;
mark_close_tag = (fun _ -> "") ; mark_close_tag = (fun _ -> "") ;
@ -728,7 +728,7 @@ let param ~name ~desc kind next = Param (name, desc, kind, next)
let seq_of_param param = let seq_of_param param =
match param Stop with match param Stop with
| Param (n, desc, parameter, Stop) -> Seq (n, desc, parameter) | Param (n, desc, parameter, Stop) -> Seq (n, desc, parameter)
| _ -> invalid_arg "Cli_entries.seq_of_param" | _ -> invalid_arg "Clic.seq_of_param"
let prefix keyword next = Prefix (keyword, next) let prefix keyword next = Prefix (keyword, next)
let rec fixed = let rec fixed =
@ -876,7 +876,7 @@ let insert_in_dispatch_tree :
TParam { l with stop = Some command } TParam { l with stop = Some command }
| _, _ -> | _, _ ->
Pervasives.failwith Pervasives.failwith
"Cli_entries.Command_tree.insert: conflicting commands" in "Clic.Command_tree.insert: conflicting commands" in
insert_tree conv root params insert_tree conv root params

16
src/lib_clic/jbuild Normal file
View File

@ -0,0 +1,16 @@
(jbuild_version 1)
(library
((name tezos_clic)
(public_name tezos-clic)
(flags (:standard -w -30
-safe-string
-open Tezos_stdlib
-open Tezos_error_monad))
(libraries (tezos-stdlib
tezos-error-monad))))
(alias
((name runtest_indent)
(deps ((glob_files *.ml*)))
(action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^}))))

View File

@ -0,0 +1,20 @@
opam-version: "1.2"
version: "dev"
maintainer: "contact@tezos.com"
authors: [ "Tezos devteam" ]
homepage: "https://www.tezos.com/"
bug-reports: "https://gitlab.com/tezos/tezos/issues"
dev-repo: "https://gitlab.com/tezos/tezos.git"
license: "unreleased"
depends: [
"ocamlfind" { build }
"jbuilder" { build & = "1.0+beta19" }
"tezos-stdlib"
"tezos-error-monad"
]
build: [
[ "jbuilder" "build" "-p" name "-j" jobs ]
]
build-test: [
[ "jbuilder" "runtest" "-p" name "-j" jobs ]
]

View File

@ -10,7 +10,7 @@
(* Tezos Command line interface - Local Storage for Configuration *) (* Tezos Command line interface - Local Storage for Configuration *)
open Lwt.Infix open Lwt.Infix
open Cli_entries open Clic
module type Entity = sig module type Entity = sig
type t type t
@ -60,13 +60,13 @@ module type Alias = sig
val alias_param : val alias_param :
?name:string -> ?name:string ->
?desc:string -> ?desc:string ->
('a, (#Client_context.wallet as 'b)) Cli_entries.params -> ('a, (#Client_context.wallet as 'b)) Clic.params ->
(string * t -> 'a, 'b) Cli_entries.params (string * t -> 'a, 'b) Clic.params
val fresh_alias_param : val fresh_alias_param :
?name:string -> ?name:string ->
?desc:string -> ?desc:string ->
('a, (< .. > as 'obj)) Cli_entries.params -> ('a, (< .. > as 'obj)) Clic.params ->
(fresh_param -> 'a, 'obj) Cli_entries.params (fresh_param -> 'a, 'obj) Clic.params
val force_switch : val force_switch :
unit -> (bool, #Client_context.full) arg unit -> (bool, #Client_context.full) arg
val of_fresh : val of_fresh :
@ -77,8 +77,8 @@ module type Alias = sig
val source_param : val source_param :
?name:string -> ?name:string ->
?desc:string -> ?desc:string ->
('a, (#Client_context.wallet as 'obj)) Cli_entries.params -> ('a, (#Client_context.wallet as 'obj)) Clic.params ->
(t -> 'a, 'obj) Cli_entries.params (t -> 'a, 'obj) Clic.params
val autocomplete: val autocomplete:
#Client_context.wallet -> string list tzresult Lwt.t #Client_context.wallet -> string list tzresult Lwt.t
end end
@ -266,7 +266,7 @@ module Alias = functor (Entity : Entity) -> struct
next next
let force_switch () = let force_switch () =
Cli_entries.switch Clic.switch
~long:"force" ~short:'f' ~long:"force" ~short:'f'
~doc:("overwrite existing " ^ Entity.name) () ~doc:("overwrite existing " ^ Entity.name) ()

View File

@ -56,15 +56,15 @@ module type Alias = sig
val alias_param : val alias_param :
?name:string -> ?name:string ->
?desc:string -> ?desc:string ->
('a, (#Client_context.wallet as 'b)) Cli_entries.params -> ('a, (#Client_context.wallet as 'b)) Clic.params ->
(string * t -> 'a, 'b) Cli_entries.params (string * t -> 'a, 'b) Clic.params
val fresh_alias_param : val fresh_alias_param :
?name:string -> ?name:string ->
?desc:string -> ?desc:string ->
('a, (< .. > as 'obj)) Cli_entries.params -> ('a, (< .. > as 'obj)) Clic.params ->
(fresh_param -> 'a, 'obj) Cli_entries.params (fresh_param -> 'a, 'obj) Clic.params
val force_switch : val force_switch :
unit -> (bool, #Client_context.full) Cli_entries.arg unit -> (bool, #Client_context.full) Clic.arg
val of_fresh : val of_fresh :
#Client_context.wallet -> #Client_context.wallet ->
bool -> bool ->
@ -73,8 +73,8 @@ module type Alias = sig
val source_param : val source_param :
?name:string -> ?name:string ->
?desc:string -> ?desc:string ->
('a, (#Client_context.wallet as 'obj)) Cli_entries.params -> ('a, (#Client_context.wallet as 'obj)) Clic.params ->
(t -> 'a, 'obj) Cli_entries.params (t -> 'a, 'obj) Clic.params
val autocomplete: val autocomplete:
#Client_context.wallet -> string list tzresult Lwt.t #Client_context.wallet -> string list tzresult Lwt.t
end end

View File

@ -281,6 +281,6 @@ let alias_keys cctxt name =
in find_key l in find_key l
let force_switch () = let force_switch () =
Cli_entries.switch Clic.switch
~long:"force" ~short:'f' ~long:"force" ~short:'f'
~doc:"overwrite existing keys" () ~doc:"overwrite existing keys" ()

View File

@ -139,4 +139,4 @@ val get_keys:
#Client_context.io_wallet -> #Client_context.io_wallet ->
(string * Public_key_hash.t * Ed25519.Public_key.t * sk_locator) list tzresult Lwt.t (string * Public_key_hash.t * Ed25519.Public_key.t * sk_locator) list tzresult Lwt.t
val force_switch : unit -> (bool, #Client_context.full) Cli_entries.arg val force_switch : unit -> (bool, #Client_context.full) Clic.arg

View File

@ -64,7 +64,7 @@ module Tags (Entity : Entity) = struct
let desc = let desc =
desc ^ "\n" desc ^ "\n"
^ "can be one or multiple tags separated by commas" in ^ "can be one or multiple tags separated by commas" in
Cli_entries.( Clic.(
param ~name ~desc param ~name ~desc
(parameter (fun _ s -> of_source s)) (parameter (fun _ s -> of_source s))
next) next)

View File

@ -28,8 +28,8 @@ module Tags (Entity : Entity) : sig
val tag_param: val tag_param:
?name:string -> ?name:string ->
?desc:string -> ?desc:string ->
('a, 'ctx) Cli_entries.params -> ('a, 'ctx) Clic.params ->
(Tag.t -> 'a, 'ctx) Cli_entries.params (Tag.t -> 'a, 'ctx) Clic.params
val rev_find_by_tag: val rev_find_by_tag:
#Client_context.full -> #Client_context.full ->

View File

@ -122,7 +122,7 @@ let default_cli_args = {
} }
open Cli_entries open Clic
let string_parameter () : (string, #Client_context.full) parameter = let string_parameter () : (string, #Client_context.full) parameter =
parameter (fun _ x -> return x) parameter (fun _ x -> return x)
@ -230,8 +230,8 @@ let read_config_file config_file =
let default_config_file_name = "config" let default_config_file_name = "config"
let commands config_file cfg = let commands config_file cfg =
let open Cli_entries in let open Clic in
let group = { Cli_entries.name = "config" ; let group = { Clic.name = "config" ;
title = "Commands for editing and viewing the client's config file" } in title = "Commands for editing and viewing the client's config file" } in
[ command ~group ~desc:"Show the config file." [ command ~group ~desc:"Show the config file."
no_options no_options

View File

@ -12,7 +12,7 @@
open Client_context_unix open Client_context_unix
let builtin_commands = let builtin_commands =
let open Cli_entries in let open Clic in
[ [
command command
~desc: "List the protocol versions that this client understands." ~desc: "List the protocol versions that this client understands."
@ -69,10 +69,10 @@ let main select_commands =
| _ :: args -> move_autocomplete_token_upfront [] args | _ :: args -> move_autocomplete_token_upfront [] args
| [] -> [], None in | [] -> [], None in
Random.self_init () ; Random.self_init () ;
ignore Cli_entries.(setup_formatter Format.std_formatter ignore Clic.(setup_formatter Format.std_formatter
(if Unix.isatty Unix.stdout then Ansi else Plain) Short) ; (if Unix.isatty Unix.stdout then Ansi else Plain) Short) ;
ignore Cli_entries.(setup_formatter Format.err_formatter ignore Clic.(setup_formatter Format.err_formatter
(if Unix.isatty Unix.stderr then Ansi else Plain) Short) ; (if Unix.isatty Unix.stderr then Ansi else Plain) Short) ;
init_logger () >>= fun () -> init_logger () >>= fun () ->
Lwt.catch begin fun () -> begin Lwt.catch begin fun () -> begin
Client_config.parse_config_args Client_config.parse_config_args
@ -91,10 +91,10 @@ let main select_commands =
let ctxt = new RPC_client.http_ctxt rpc_config Media_type.all_media_types in let ctxt = new RPC_client.http_ctxt rpc_config Media_type.all_media_types in
select_commands ctxt parsed_args >>=? fun commands -> select_commands ctxt parsed_args >>=? fun commands ->
let commands = let commands =
Cli_entries.add_manual Clic.add_manual
~executable_name ~executable_name
~global_options ~global_options
(if Unix.isatty Unix.stdout then Cli_entries.Ansi else Cli_entries.Plain) (if Unix.isatty Unix.stdout then Clic.Ansi else Clic.Plain)
Format.std_formatter Format.std_formatter
(config_commands @ builtin_commands @ commands) in (config_commands @ builtin_commands @ commands) in
let rpc_config = let rpc_config =
@ -112,26 +112,26 @@ let main select_commands =
~rpc_config:rpc_config in ~rpc_config:rpc_config in
begin match autocomplete with begin match autocomplete with
| Some (prev_arg, cur_arg, script) -> | Some (prev_arg, cur_arg, script) ->
Cli_entries.autocompletion Clic.autocompletion
~script ~cur_arg ~prev_arg ~args:original_args ~global_options ~script ~cur_arg ~prev_arg ~args:original_args ~global_options
commands client_config >>=? fun completions -> commands client_config >>=? fun completions ->
List.iter print_endline completions ; List.iter print_endline completions ;
return () return ()
| None -> | None ->
Cli_entries.dispatch commands client_config remaining Clic.dispatch commands client_config remaining
end end
end >>= function end >>= function
| Ok () -> | Ok () ->
Lwt.return 0 Lwt.return 0
| Error [ Cli_entries.Help command ] -> | Error [ Clic.Help command ] ->
Cli_entries.usage Clic.usage
Format.std_formatter Format.std_formatter
~executable_name ~executable_name
~global_options ~global_options
(match command with None -> [] | Some c -> [ c ]) ; (match command with None -> [] | Some c -> [ c ]) ;
Lwt.return 0 Lwt.return 0
| Error errs -> | Error errs ->
Cli_entries.pp_cli_errors Clic.pp_cli_errors
Format.err_formatter Format.err_formatter
~executable_name ~executable_name
~global_options ~global_options

View File

@ -10,5 +10,5 @@
val run : val run :
(RPC_client.http_ctxt -> (RPC_client.http_ctxt ->
Client_config.cli_args -> Client_config.cli_args ->
Client_context.full Cli_entries.command list tzresult Lwt.t) -> Client_context.full Clic.command list tzresult Lwt.t) ->
unit unit

View File

@ -8,7 +8,7 @@
(**************************************************************************) (**************************************************************************)
let commands () = let commands () =
let open Cli_entries in let open Clic in
let group = { name = "admin" ; let group = { name = "admin" ;
title = "Commands to perform privileged operations on the node" } in title = "Commands to perform privileged operations on the node" } in
[ [

View File

@ -7,4 +7,4 @@
(* *) (* *)
(**************************************************************************) (**************************************************************************)
val commands : unit -> #Client_context.full Cli_entries.command list val commands : unit -> #Client_context.full Clic.command list

View File

@ -9,7 +9,7 @@
open Client_context open Client_context
type command = full Cli_entries.command type command = full Clic.command
exception Version_not_found exception Version_not_found

View File

@ -9,7 +9,7 @@
open Client_context open Client_context
type command = full Cli_entries.command type command = full Clic.command
exception Version_not_found exception Version_not_found

View File

@ -8,13 +8,13 @@
(**************************************************************************) (**************************************************************************)
let unique_switch = let unique_switch =
Cli_entries.switch Clic.switch
~long:"unique" ~long:"unique"
~short:'u' ~short:'u'
~doc:"Fail when there is more than one possible completion." ~doc:"Fail when there is more than one possible completion."
() ()
let commands () = Cli_entries.[ let commands () = Clic.[
command command
~desc: "Autocomplete a prefix of Base58Check-encoded hash.\n\ ~desc: "Autocomplete a prefix of Base58Check-encoded hash.\n\
This actually works only for blocks, operations, public \ This actually works only for blocks, operations, public \

View File

@ -10,11 +10,11 @@
open Client_keys open Client_keys
let group = let group =
{ Cli_entries.name = "keys" ; { Clic.name = "keys" ;
title = "Commands for managing the wallet of cryptographic keys" } title = "Commands for managing the wallet of cryptographic keys" }
let commands () = let commands () =
let open Cli_entries in let open Clic in
let show_private_switch = let show_private_switch =
switch switch
~long:"show-secret" ~long:"show-secret"
@ -195,7 +195,7 @@ let commands () =
else return ()) ; else return ()) ;
command ~group ~desc: "Forget the entire wallet of keys." command ~group ~desc: "Forget the entire wallet of keys."
(args1 (Cli_entries.switch (args1 (Clic.switch
~long:"force" ~short:'f' ~long:"force" ~short:'f'
~doc:"you got to use the force for that" ())) ~doc:"you got to use the force for that" ()))
(fixed [ "forget" ; "all" ; "keys" ]) (fixed [ "forget" ; "all" ; "keys" ])

View File

@ -8,11 +8,11 @@
(**************************************************************************) (**************************************************************************)
let group = let group =
{ Cli_entries.name = "p2p" ; { Clic.name = "p2p" ;
title = "Commands for monitoring and controlling p2p-layer state" } title = "Commands for monitoring and controlling p2p-layer state" }
let commands () = [ let commands () = [
let open Cli_entries in let open Clic in
command ~group ~desc: "show global network status" command ~group ~desc: "show global network status"
no_options no_options
(prefixes ["p2p" ; "stat"] stop) begin fun () (cctxt : #Client_context.full) -> (prefixes ["p2p" ; "stat"] stop) begin fun () (cctxt : #Client_context.full) ->

View File

@ -41,7 +41,7 @@ let print_rejected ppf = function
invalid invalid
let commands () = let commands () =
let open Cli_entries in let open Clic in
let group = { name = "report" ; let group = { name = "report" ;
title = "Commands to report the node's status" } in title = "Commands to report the node's status" } in
let output_arg = let output_arg =
@ -55,7 +55,7 @@ let commands () =
| "-" -> return Format.std_formatter | "-" -> return Format.std_formatter
| file -> | file ->
let ppf = Format.formatter_of_out_channel (open_out file) in let ppf = Format.formatter_of_out_channel (open_out file) in
ignore Cli_entries.(setup_formatter ppf Plain Full) ; ignore Clic.(setup_formatter ppf Plain Full) ;
return ppf)) in return ppf)) in
[ [
command ~group command ~group

View File

@ -8,4 +8,4 @@
(**************************************************************************) (**************************************************************************)
val commands : unit -> #Client_context.full Cli_entries.command list val commands : unit -> #Client_context.full Clic.command list

View File

@ -10,7 +10,7 @@
let select_commands _ _ = let select_commands _ _ =
return return
(List.map (List.map
(Cli_entries.map_command (new Proto_alpha.wrap_full)) (Clic.map_command (new Proto_alpha.wrap_full))
(Client_baking_commands.commands ())) (Client_baking_commands.commands ()))
let () = Client_main_run.run select_commands let () = Client_main_run.run select_commands

View File

@ -11,11 +11,11 @@ open Client_proto_args
open Client_baking_lib open Client_baking_lib
let group = let group =
{ Cli_entries.name = "delegate" ; { Clic.name = "delegate" ;
title = "Commands related to delegate operations." } title = "Commands related to delegate operations." }
let commands () = let commands () =
let open Cli_entries in let open Clic in
[ [
command ~group ~desc: "Launch a daemon that handles delegate operations." command ~group ~desc: "Launch a daemon that handles delegate operations."
(args5 max_priority_arg endorsement_delay_arg (args5 max_priority_arg endorsement_delay_arg

View File

@ -7,4 +7,4 @@
(* *) (* *)
(**************************************************************************) (**************************************************************************)
val commands: unit -> Proto_alpha.full Cli_entries.command list val commands: unit -> Proto_alpha.full Clic.command list

View File

@ -9,5 +9,5 @@
let () = let () =
Client_commands.register Proto_alpha.hash @@ Client_commands.register Proto_alpha.hash @@
List.map (Cli_entries.map_command (new Proto_alpha.wrap_full)) @@ List.map (Clic.map_command (new Proto_alpha.wrap_full)) @@
Client_baking_commands.commands () Client_baking_commands.commands ()

View File

@ -9,7 +9,7 @@
open Proto_alpha open Proto_alpha
open Alpha_context open Alpha_context
open Cli_entries open Clic
type error += Bad_tez_arg of string * string (* Arg_name * value *) type error += Bad_tez_arg of string * string (* Arg_name * value *)
type error += Bad_max_priority of string type error += Bad_max_priority of string
@ -130,7 +130,7 @@ let tez_arg ~default ~parameter ~doc =
(tez_parameter ("--" ^ parameter)) (tez_parameter ("--" ^ parameter))
let tez_param ~name ~desc next = let tez_param ~name ~desc next =
Cli_entries.param Clic.param
~name ~name
~desc:(desc ^ " in \xEA\x9C\xA9\n" ^ tez_format) ~desc:(desc ^ " in \xEA\x9C\xA9\n" ^ tez_format)
(tez_parameter name) (tez_parameter name)

View File

@ -12,36 +12,36 @@ open Alpha_context
val tez_sym: string val tez_sym: string
val init_arg: (string, Proto_alpha.full) Cli_entries.arg val init_arg: (string, Proto_alpha.full) Clic.arg
val fee_arg: (Tez.t, Proto_alpha.full) Cli_entries.arg val fee_arg: (Tez.t, Proto_alpha.full) Clic.arg
val arg_arg: (string, Proto_alpha.full) Cli_entries.arg val arg_arg: (string, Proto_alpha.full) Clic.arg
val source_arg: (string option, Proto_alpha.full) Cli_entries.arg val source_arg: (string option, Proto_alpha.full) Clic.arg
val delegate_arg: (string option, Proto_alpha.full) Cli_entries.arg val delegate_arg: (string option, Proto_alpha.full) Clic.arg
val delegatable_switch: (bool, Proto_alpha.full) Cli_entries.arg val delegatable_switch: (bool, Proto_alpha.full) Clic.arg
val spendable_switch: (bool, Proto_alpha.full) Cli_entries.arg val spendable_switch: (bool, Proto_alpha.full) Clic.arg
val max_priority_arg: (int option, Proto_alpha.full) Cli_entries.arg val max_priority_arg: (int option, Proto_alpha.full) Clic.arg
val free_baking_switch: (bool, Proto_alpha.full) Cli_entries.arg val free_baking_switch: (bool, Proto_alpha.full) Clic.arg
val force_switch: (bool, Proto_alpha.full) Cli_entries.arg val force_switch: (bool, Proto_alpha.full) Clic.arg
val endorsement_delay_arg: (int, Proto_alpha.full) Cli_entries.arg val endorsement_delay_arg: (int, Proto_alpha.full) Clic.arg
val no_print_source_flag : (bool, Proto_alpha.full) Cli_entries.arg val no_print_source_flag : (bool, Proto_alpha.full) Clic.arg
val tez_arg : val tez_arg :
default:string -> default:string ->
parameter:string -> parameter:string ->
doc:string -> doc:string ->
(Tez.t, Proto_alpha.full) Cli_entries.arg (Tez.t, Proto_alpha.full) Clic.arg
val tez_param : val tez_param :
name:string -> name:string ->
desc:string -> desc:string ->
('a, full) Cli_entries.params -> ('a, full) Clic.params ->
(Tez.t -> 'a, full) Cli_entries.params (Tez.t -> 'a, full) Clic.params
module Daemon : sig module Daemon : sig
val baking_switch: (bool, Proto_alpha.full) Cli_entries.arg val baking_switch: (bool, Proto_alpha.full) Clic.arg
val endorsement_switch: (bool, Proto_alpha.full) Cli_entries.arg val endorsement_switch: (bool, Proto_alpha.full) Clic.arg
val denunciation_switch: (bool, Proto_alpha.full) Cli_entries.arg val denunciation_switch: (bool, Proto_alpha.full) Clic.arg
end end
val string_parameter : (string, full) Cli_entries.parameter val string_parameter : (string, full) Clic.parameter

View File

@ -66,7 +66,7 @@ module ContractAlias = struct
desc ^ "\n" desc ^ "\n"
^ "Can be a contract alias or a key alias (autodetected in order).\n\ ^ "Can be a contract alias or a key alias (autodetected in order).\n\
Use 'key:name' to force the later." in Use 'key:name' to force the later." in
Cli_entries.( Clic.(
param ~name ~desc param ~name ~desc
(parameter ~autocomplete:autocomplete (parameter ~autocomplete:autocomplete
(fun cctxt p -> get_contract cctxt p)) (fun cctxt p -> get_contract cctxt p))
@ -77,7 +77,7 @@ module ContractAlias = struct
desc ^ "\n" desc ^ "\n"
^ "Can be an alias, a key, or a literal (autodetected in order).\n\ ^ "Can be an alias, a key, or a literal (autodetected in order).\n\
Use 'text:literal', 'alias:name', 'key:name' to force." in Use 'text:literal', 'alias:name', 'key:name' to force." in
Cli_entries.( Clic.(
param ~name ~desc param ~name ~desc
(parameter (parameter
~autocomplete:(fun cctxt -> ~autocomplete:(fun cctxt ->

View File

@ -9,7 +9,7 @@
open Proto_alpha open Proto_alpha
open Alpha_context open Alpha_context
open Cli_entries open Clic
module RawContractAlias : module RawContractAlias :
Client_aliases.Alias with type t = Contract.t Client_aliases.Alias with type t = Contract.t

View File

@ -9,7 +9,7 @@
let () = let () =
Client_commands.register Proto_alpha.hash @@ Client_commands.register Proto_alpha.hash @@
List.map (Cli_entries.map_command (new Proto_alpha.wrap_full)) @@ List.map (Clic.map_command (new Proto_alpha.wrap_full)) @@
Client_proto_programs_commands.commands () @ Client_proto_programs_commands.commands () @
Client_proto_contracts_commands.commands () @ Client_proto_contracts_commands.commands () @
Client_proto_context_commands.commands () Client_proto_context_commands.commands ()

View File

@ -81,15 +81,15 @@ let wait_for_operation_inclusion
return () return ()
let group = let group =
{ Cli_entries.name = "context" ; { Clic.name = "context" ;
title = "Block contextual commands (see option -block)" } title = "Block contextual commands (see option -block)" }
let alphanet = let alphanet =
{ Cli_entries.name = "alphanet" ; { Clic.name = "alphanet" ;
title = "Alphanet only commands" } title = "Alphanet only commands" }
let commands () = let commands () =
let open Cli_entries in let open Clic in
[ [
command ~group ~desc: "Access the timestamp of the block." command ~group ~desc: "Access the timestamp of the block."
no_options no_options

View File

@ -12,11 +12,11 @@ open Alpha_context
open Client_proto_contracts open Client_proto_contracts
let group = let group =
{ Cli_entries.name = "contracts" ; { Clic.name = "contracts" ;
title = "Commands for managing the record of known contracts" } title = "Commands for managing the record of known contracts" }
let commands () = let commands () =
let open Cli_entries in let open Clic in
[ [
command ~group ~desc: "Add a contract to the wallet." command ~group ~desc: "Add a contract to the wallet."

View File

@ -10,7 +10,7 @@
open Proto_alpha open Proto_alpha
let group = let group =
{ Cli_entries.name = "programs" ; { Clic.name = "programs" ;
title = "Commands for managing the library of known programs" } title = "Commands for managing the library of known programs" }
open Tezos_micheline open Tezos_micheline
@ -18,7 +18,7 @@ open Client_proto_programs
open Client_proto_args open Client_proto_args
let commands () = let commands () =
let open Cli_entries in let open Clic in
let show_types_switch = let show_types_switch =
switch switch
~long:"details" ~long:"details"
@ -42,7 +42,7 @@ let commands () =
~doc:"amount of the transfer in \xEA\x9C\xA9" ~doc:"amount of the transfer in \xEA\x9C\xA9"
~default:"0.05" in ~default:"0.05" in
let data_parameter = let data_parameter =
Cli_entries.parameter (fun _ data -> Clic.parameter (fun _ data ->
Lwt.return (Micheline_parser.no_parsing_error Lwt.return (Micheline_parser.no_parsing_error
@@ Michelson_v1_parser.parse_expression data)) in @@ Michelson_v1_parser.parse_expression data)) in
[ [
@ -87,10 +87,10 @@ let commands () =
(prefixes [ "run" ; "program" ] (prefixes [ "run" ; "program" ]
@@ Program.source_param @@ Program.source_param
@@ prefixes [ "on" ; "storage" ] @@ prefixes [ "on" ; "storage" ]
@@ Cli_entries.param ~name:"storage" ~desc:"the storage data" @@ Clic.param ~name:"storage" ~desc:"the storage data"
data_parameter data_parameter
@@ prefixes [ "and" ; "input" ] @@ prefixes [ "and" ; "input" ]
@@ Cli_entries.param ~name:"storage" ~desc:"the input data" @@ Clic.param ~name:"storage" ~desc:"the input data"
data_parameter data_parameter
@@ stop) @@ stop)
(fun (trace_exec, amount, no_print_source) program storage input cctxt -> (fun (trace_exec, amount, no_print_source) program storage input cctxt ->
@ -137,10 +137,10 @@ let commands () =
command ~group ~desc: "Ask the node to typecheck a data expression." command ~group ~desc: "Ask the node to typecheck a data expression."
(args1 no_print_source_flag) (args1 no_print_source_flag)
(prefixes [ "typecheck" ; "data" ] (prefixes [ "typecheck" ; "data" ]
@@ Cli_entries.param ~name:"data" ~desc:"the data to typecheck" @@ Clic.param ~name:"data" ~desc:"the data to typecheck"
data_parameter data_parameter
@@ prefixes [ "against" ; "type" ] @@ prefixes [ "against" ; "type" ]
@@ Cli_entries.param ~name:"type" ~desc:"the expected type" @@ Clic.param ~name:"type" ~desc:"the expected type"
data_parameter data_parameter
@@ stop) @@ stop)
(fun no_print_source data ty cctxt -> (fun no_print_source data ty cctxt ->
@ -162,10 +162,10 @@ let commands () =
instruction `H` would have produced." instruction `H` would have produced."
no_options no_options
(prefixes [ "hash" ; "data" ] (prefixes [ "hash" ; "data" ]
@@ Cli_entries.param ~name:"data" ~desc:"the data to hash" @@ Clic.param ~name:"data" ~desc:"the data to hash"
data_parameter data_parameter
@@ prefixes [ "of" ; "type" ] @@ prefixes [ "of" ; "type" ]
@@ Cli_entries.param ~name:"type" ~desc:"type of the data" @@ Clic.param ~name:"type" ~desc:"type of the data"
data_parameter data_parameter
@@ stop) @@ stop)
(fun () data typ cctxt -> (fun () data typ cctxt ->
@ -186,10 +186,10 @@ let commands () =
instruction `CHECK_SIGNATURE`." instruction `CHECK_SIGNATURE`."
no_options no_options
(prefixes [ "hash" ; "and" ; "sign" ; "data" ] (prefixes [ "hash" ; "and" ; "sign" ; "data" ]
@@ Cli_entries.param ~name:"data" ~desc:"the data to hash" @@ Clic.param ~name:"data" ~desc:"the data to hash"
data_parameter data_parameter
@@ prefixes [ "of" ; "type" ] @@ prefixes [ "of" ; "type" ]
@@ Cli_entries.param ~name:"type" ~desc:"type of the data" @@ Clic.param ~name:"type" ~desc:"type of the data"
data_parameter data_parameter
@@ prefixes [ "for" ] @@ prefixes [ "for" ]
@@ Client_keys.Secret_key.alias_param @@ Client_keys.Secret_key.alias_param

View File

@ -7,4 +7,4 @@
(* *) (* *)
(**************************************************************************) (**************************************************************************)
val commands: unit -> Proto_alpha.full Cli_entries.command list val commands: unit -> Proto_alpha.full Clic.command list

View File

@ -66,7 +66,7 @@ let handle_error cctxt = function
cctxt.Client_commands.error "%s" "cannot continue" cctxt.Client_commands.error "%s" "cannot continue"
let commands () = let commands () =
let open Cli_entries in let open Clic in
let group = {name = "demo" ; title = "Some demo command" } in let group = {name = "demo" ; title = "Some demo command" } in
[ [
command ~group ~desc: "A demo command" command ~group ~desc: "A demo command"

View File

@ -25,17 +25,17 @@ let bake cctxt ?(timestamp = Time.now ()) block command sk =
Shell_services.inject_block cctxt signed_blk [] Shell_services.inject_block cctxt signed_blk []
let int64_parameter = let int64_parameter =
(Cli_entries.parameter (fun _ p -> (Clic.parameter (fun _ p ->
try return (Int64.of_string p) try return (Int64.of_string p)
with _ -> failwith "Cannot read int64")) with _ -> failwith "Cannot read int64"))
let int_parameter = let int_parameter =
(Cli_entries.parameter (fun _ p -> (Clic.parameter (fun _ p ->
try return (int_of_string p) try return (int_of_string p)
with _ -> failwith "Cannot read int")) with _ -> failwith "Cannot read int"))
let commands () = let commands () =
let open Cli_entries in let open Clic in
let args = let args =
args1 args1
(arg (arg