Base: rename Cli_entries
into Clic
This commit is contained in:
parent
4ad127c398
commit
08a3cff5a6
121
.gitlab-ci.yml
121
.gitlab-ci.yml
@ -279,36 +279,36 @@ opam:08:tezos-micheline:
|
||||
variables:
|
||||
package: tezos-micheline
|
||||
|
||||
opam:09:tezos-protocol-environment-sigs:
|
||||
<<: *opam_definition
|
||||
variables:
|
||||
package: tezos-protocol-environment-sigs
|
||||
|
||||
opam:10:tezos-rpc:
|
||||
opam:09:tezos-rpc:
|
||||
<<: *opam_definition
|
||||
variables:
|
||||
package: tezos-rpc
|
||||
|
||||
opam:11:tezos-base:
|
||||
opam:10:tezos-base:
|
||||
<<: *opam_definition
|
||||
variables:
|
||||
package: tezos-base
|
||||
|
||||
opam:12:pbkdf:
|
||||
opam:11:pbkdf:
|
||||
<<: *opam_definition
|
||||
variables:
|
||||
package: pbkdf
|
||||
|
||||
opam:13:ocplib-resto-cohttp:
|
||||
opam:12:ocplib-resto-cohttp:
|
||||
<<: *opam_definition
|
||||
variables:
|
||||
package: ocplib-resto-cohttp
|
||||
|
||||
opam:14:irmin-leveldb:
|
||||
opam:13:irmin-leveldb:
|
||||
<<: *opam_definition
|
||||
variables:
|
||||
package: irmin-leveldb
|
||||
|
||||
opam:14:tezos-protocol-environment-sigs:
|
||||
<<: *opam_definition
|
||||
variables:
|
||||
package: tezos-protocol-environment-sigs
|
||||
|
||||
opam:15:tezos-stdlib-unix:
|
||||
<<: *opam_definition
|
||||
variables:
|
||||
@ -364,105 +364,110 @@ opam:25:tezos-client-commands:
|
||||
variables:
|
||||
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
|
||||
variables:
|
||||
package: tezos-baking-alpha
|
||||
|
||||
opam:27:tezos-protocol-genesis:
|
||||
opam:28:tezos-protocol-genesis:
|
||||
<<: *opam_definition
|
||||
variables:
|
||||
package: tezos-protocol-genesis
|
||||
|
||||
opam:28:tezos-protocol-updater:
|
||||
<<: *opam_definition
|
||||
variables:
|
||||
package: tezos-protocol-updater
|
||||
|
||||
opam:29:tezos-p2p:
|
||||
<<: *opam_definition
|
||||
variables:
|
||||
package: tezos-p2p
|
||||
|
||||
opam:30:ocplib-resto-json:
|
||||
opam:29:ocplib-resto-json:
|
||||
<<: *opam_definition
|
||||
variables:
|
||||
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
|
||||
variables:
|
||||
package: tezos-baking-alpha-commands
|
||||
|
||||
opam:32:tezos-client-alpha-commands:
|
||||
opam:33:tezos-client-alpha-commands:
|
||||
<<: *opam_definition
|
||||
variables:
|
||||
package: tezos-client-alpha-commands
|
||||
|
||||
opam:33:tezos-client-base-unix:
|
||||
opam:34:tezos-client-base-unix:
|
||||
<<: *opam_definition
|
||||
variables:
|
||||
package: tezos-client-base-unix
|
||||
|
||||
opam:34:tezos-client-genesis:
|
||||
opam:35:tezos-client-genesis:
|
||||
<<: *opam_definition
|
||||
variables:
|
||||
package: tezos-client-genesis
|
||||
|
||||
opam:35:tezos-embedded-protocol-alpha:
|
||||
<<: *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:36:ocplib-ezresto:
|
||||
<<: *opam_definition
|
||||
variables:
|
||||
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
|
||||
variables:
|
||||
package: tezos-client
|
||||
|
||||
opam:41:tezos-node:
|
||||
<<: *opam_definition
|
||||
variables:
|
||||
package: tezos-node
|
||||
|
||||
opam:42:ocplib-ezresto-directory:
|
||||
<<: *opam_definition
|
||||
variables:
|
||||
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
|
||||
variables:
|
||||
package: tezos-baker-alpha
|
||||
|
||||
opam:44:tezos-protocol-demo:
|
||||
opam:45:tezos-protocol-demo:
|
||||
<<: *opam_definition
|
||||
variables:
|
||||
package: tezos-protocol-demo
|
||||
|
||||
opam:45:tezos-protocol-environment-shell:
|
||||
opam:46:tezos-node:
|
||||
<<: *opam_definition
|
||||
variables:
|
||||
package: tezos-protocol-environment-shell
|
||||
package: tezos-node
|
||||
|
||||
|
||||
##END_OPAM##
|
||||
|
@ -8,11 +8,11 @@
|
||||
(**************************************************************************)
|
||||
|
||||
let group =
|
||||
{ Cli_entries.name = "protocols" ;
|
||||
{ Clic.name = "protocols" ;
|
||||
title = "Commands for managing protocols" }
|
||||
|
||||
let commands () =
|
||||
let open Cli_entries in
|
||||
let open Clic in
|
||||
let check_dir _ dn =
|
||||
if Sys.is_directory dn then
|
||||
return dn
|
||||
|
@ -10,7 +10,7 @@
|
||||
(* Tezos Command line interface - Generic JSON RPC interface *)
|
||||
|
||||
open Lwt.Infix
|
||||
open Cli_entries
|
||||
open Clic
|
||||
open Json_schema
|
||||
|
||||
(*-- 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
|
||||
|
||||
let group =
|
||||
{ Cli_entries.name = "rpc" ;
|
||||
{ Clic.name = "rpc" ;
|
||||
title = "Commands for the low level RPC layer" }
|
||||
|
||||
let commands = [
|
||||
|
@ -51,9 +51,9 @@ module Extend(H : Tezos_crypto.S.HASH) = struct
|
||||
()
|
||||
|
||||
let param ?(name=H.name) ?(desc=H.title) t =
|
||||
Cli_entries.param
|
||||
Clic.param
|
||||
~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
|
||||
include Set.Make(struct type nonrec t = t let compare = compare end)
|
||||
|
@ -31,7 +31,7 @@ module Public_key = struct
|
||||
let param
|
||||
?(name="ed25519-public")
|
||||
?(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)
|
||||
|
||||
end
|
||||
@ -66,7 +66,7 @@ module Secret_key = struct
|
||||
let param
|
||||
?(name="ed25519-secret")
|
||||
?(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)
|
||||
end
|
||||
|
||||
@ -100,7 +100,7 @@ module Signature = struct
|
||||
let param
|
||||
?(name="ed25519-signature")
|
||||
?(desc="Ed25519 signature (b58check-encoded)") t =
|
||||
Cli_entries.(param ~name ~desc
|
||||
Clic.(param ~name ~desc
|
||||
(parameter (fun _ str -> Lwt.return (of_b58check str))) t)
|
||||
end
|
||||
|
||||
|
@ -10,8 +10,8 @@ module Public_key : sig
|
||||
val param:
|
||||
?name:string ->
|
||||
?desc:string ->
|
||||
('a, 'b) Cli_entries.params ->
|
||||
(t -> 'a, 'b) Cli_entries.params
|
||||
('a, 'b) Clic.params ->
|
||||
(t -> 'a, 'b) Clic.params
|
||||
val of_b58check: string -> t tzresult
|
||||
end
|
||||
|
||||
@ -21,8 +21,8 @@ module Secret_key : sig
|
||||
val param:
|
||||
?name:string ->
|
||||
?desc:string ->
|
||||
('a, 'b) Cli_entries.params ->
|
||||
(t -> 'a, 'b) Cli_entries.params
|
||||
('a, 'b) Clic.params ->
|
||||
(t -> 'a, 'b) Clic.params
|
||||
val of_b58check: string -> t tzresult
|
||||
end
|
||||
|
||||
@ -32,8 +32,8 @@ module Signature : sig
|
||||
val param:
|
||||
?name:string ->
|
||||
?desc:string ->
|
||||
('a, 'b) Cli_entries.params ->
|
||||
(t -> 'a, 'b) Cli_entries.params
|
||||
('a, 'b) Clic.params ->
|
||||
(t -> 'a, 'b) Clic.params
|
||||
val of_b58check: string -> t tzresult
|
||||
end
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
-open Tezos_data_encoding
|
||||
-open Tezos_error_monad
|
||||
-open Tezos_rpc
|
||||
-open Tezos_clic
|
||||
-open Tezos_micheline
|
||||
-safe-string))
|
||||
(libraries (tezos-stdlib
|
||||
@ -16,6 +17,7 @@
|
||||
tezos-data-encoding
|
||||
tezos-error-monad
|
||||
tezos-rpc
|
||||
tezos-clic
|
||||
tezos-micheline
|
||||
re.str
|
||||
calendar
|
||||
|
@ -146,8 +146,8 @@ module type INTERNAL_HASH = sig
|
||||
val param:
|
||||
?name:string ->
|
||||
?desc:string ->
|
||||
('a, 'arg) Cli_entries.params ->
|
||||
(t -> 'a, 'arg) Cli_entries.params
|
||||
('a, 'arg) Clic.params ->
|
||||
(t -> 'a, 'arg) Clic.params
|
||||
|
||||
module Set : sig
|
||||
include Set.S with type elt = t
|
||||
@ -196,8 +196,8 @@ module type INTERNAL_MERKLE_TREE = sig
|
||||
val param:
|
||||
?name:string ->
|
||||
?desc:string ->
|
||||
('a, 'arg) Cli_entries.params ->
|
||||
(t -> 'a, 'arg) Cli_entries.params
|
||||
('a, 'arg) Clic.params ->
|
||||
(t -> 'a, 'arg) Clic.params
|
||||
|
||||
module Set : sig
|
||||
include Set.S with type elt = t
|
||||
|
@ -11,6 +11,7 @@ include Tezos_stdlib
|
||||
include Tezos_data_encoding
|
||||
include Tezos_error_monad
|
||||
include Tezos_rpc
|
||||
include Tezos_clic
|
||||
include Tezos_micheline
|
||||
|
||||
module Ed25519 = Ed25519
|
||||
@ -55,7 +56,6 @@ module P2p_connection = P2p_connection
|
||||
module P2p_stat = P2p_stat
|
||||
module P2p_version = P2p_version
|
||||
|
||||
module Cli_entries = Cli_entries
|
||||
module Lwt_exit = Lwt_exit
|
||||
|
||||
include Utils.Infix
|
||||
|
@ -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_error_monad end))
|
||||
include (module type of (struct include Tezos_rpc end))
|
||||
include (module type of (struct include Tezos_clic end))
|
||||
|
||||
module Ed25519 = Ed25519
|
||||
module Crypto_box = Crypto_box
|
||||
@ -52,7 +53,6 @@ module P2p_connection = P2p_connection
|
||||
module P2p_stat = P2p_stat
|
||||
module P2p_version = P2p_version
|
||||
|
||||
module Cli_entries = Cli_entries
|
||||
module Lwt_exit = Lwt_exit
|
||||
|
||||
include (module type of (struct include Utils.Infix end))
|
||||
|
@ -260,7 +260,7 @@ let group_commands commands =
|
||||
let ({ title ; _ }, r) =
|
||||
List.find (fun ({ name ; _ }, _) -> group.name = name) grouped in
|
||||
if title <> group.title then
|
||||
invalid_arg "Cli_entries.usage: duplicate group name" ;
|
||||
invalid_arg "Clic.usage: duplicate group name" ;
|
||||
r := command :: !r ;
|
||||
(grouped, ungrouped)
|
||||
with Not_found ->
|
||||
@ -315,7 +315,7 @@ let setup_formatter ppf format verbosity =
|
||||
let pop_level () =
|
||||
match !levels with
|
||||
| _ :: 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, (<=)) ;
|
||||
let push_level_tag tag =
|
||||
let push op = function
|
||||
@ -323,7 +323,7 @@ let setup_formatter ppf format verbosity =
|
||||
| "details" -> push_level (Details, op)
|
||||
| "short" -> push_level (Short, 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
|
||||
push (=) (String.sub tag 1 (String.length tag - 1))
|
||||
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" -> pop_level ()
|
||||
| tag -> Pervasives.failwith ("Cli_entries: invalid semantic tag <" ^ tag ^ ">") in
|
||||
| tag -> Pervasives.failwith ("Clic: invalid semantic tag <" ^ tag ^ ">") in
|
||||
match format with
|
||||
| Ansi ->
|
||||
let color_num = function
|
||||
@ -373,7 +373,7 @@ let setup_formatter ppf format verbosity =
|
||||
| _ :: format :: rest ->
|
||||
ansi_stack := format :: rest ;
|
||||
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
|
||||
{ mark_open_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 =
|
||||
match param Stop with
|
||||
| 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 rec fixed =
|
||||
@ -876,7 +876,7 @@ let insert_in_dispatch_tree :
|
||||
TParam { l with stop = Some command }
|
||||
| _, _ ->
|
||||
Pervasives.failwith
|
||||
"Cli_entries.Command_tree.insert: conflicting commands" in
|
||||
"Clic.Command_tree.insert: conflicting commands" in
|
||||
insert_tree conv root params
|
||||
|
||||
|
16
src/lib_clic/jbuild
Normal file
16
src/lib_clic/jbuild
Normal 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} ${^}))))
|
20
src/lib_clic/tezos-clic.opam
Normal file
20
src/lib_clic/tezos-clic.opam
Normal 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 ]
|
||||
]
|
@ -10,7 +10,7 @@
|
||||
(* Tezos Command line interface - Local Storage for Configuration *)
|
||||
|
||||
open Lwt.Infix
|
||||
open Cli_entries
|
||||
open Clic
|
||||
|
||||
module type Entity = sig
|
||||
type t
|
||||
@ -60,13 +60,13 @@ module type Alias = sig
|
||||
val alias_param :
|
||||
?name:string ->
|
||||
?desc:string ->
|
||||
('a, (#Client_context.wallet as 'b)) Cli_entries.params ->
|
||||
(string * t -> 'a, 'b) Cli_entries.params
|
||||
('a, (#Client_context.wallet as 'b)) Clic.params ->
|
||||
(string * t -> 'a, 'b) Clic.params
|
||||
val fresh_alias_param :
|
||||
?name:string ->
|
||||
?desc:string ->
|
||||
('a, (< .. > as 'obj)) Cli_entries.params ->
|
||||
(fresh_param -> 'a, 'obj) Cli_entries.params
|
||||
('a, (< .. > as 'obj)) Clic.params ->
|
||||
(fresh_param -> 'a, 'obj) Clic.params
|
||||
val force_switch :
|
||||
unit -> (bool, #Client_context.full) arg
|
||||
val of_fresh :
|
||||
@ -77,8 +77,8 @@ module type Alias = sig
|
||||
val source_param :
|
||||
?name:string ->
|
||||
?desc:string ->
|
||||
('a, (#Client_context.wallet as 'obj)) Cli_entries.params ->
|
||||
(t -> 'a, 'obj) Cli_entries.params
|
||||
('a, (#Client_context.wallet as 'obj)) Clic.params ->
|
||||
(t -> 'a, 'obj) Clic.params
|
||||
val autocomplete:
|
||||
#Client_context.wallet -> string list tzresult Lwt.t
|
||||
end
|
||||
@ -266,7 +266,7 @@ module Alias = functor (Entity : Entity) -> struct
|
||||
next
|
||||
|
||||
let force_switch () =
|
||||
Cli_entries.switch
|
||||
Clic.switch
|
||||
~long:"force" ~short:'f'
|
||||
~doc:("overwrite existing " ^ Entity.name) ()
|
||||
|
||||
|
@ -56,15 +56,15 @@ module type Alias = sig
|
||||
val alias_param :
|
||||
?name:string ->
|
||||
?desc:string ->
|
||||
('a, (#Client_context.wallet as 'b)) Cli_entries.params ->
|
||||
(string * t -> 'a, 'b) Cli_entries.params
|
||||
('a, (#Client_context.wallet as 'b)) Clic.params ->
|
||||
(string * t -> 'a, 'b) Clic.params
|
||||
val fresh_alias_param :
|
||||
?name:string ->
|
||||
?desc:string ->
|
||||
('a, (< .. > as 'obj)) Cli_entries.params ->
|
||||
(fresh_param -> 'a, 'obj) Cli_entries.params
|
||||
('a, (< .. > as 'obj)) Clic.params ->
|
||||
(fresh_param -> 'a, 'obj) Clic.params
|
||||
val force_switch :
|
||||
unit -> (bool, #Client_context.full) Cli_entries.arg
|
||||
unit -> (bool, #Client_context.full) Clic.arg
|
||||
val of_fresh :
|
||||
#Client_context.wallet ->
|
||||
bool ->
|
||||
@ -73,8 +73,8 @@ module type Alias = sig
|
||||
val source_param :
|
||||
?name:string ->
|
||||
?desc:string ->
|
||||
('a, (#Client_context.wallet as 'obj)) Cli_entries.params ->
|
||||
(t -> 'a, 'obj) Cli_entries.params
|
||||
('a, (#Client_context.wallet as 'obj)) Clic.params ->
|
||||
(t -> 'a, 'obj) Clic.params
|
||||
val autocomplete:
|
||||
#Client_context.wallet -> string list tzresult Lwt.t
|
||||
end
|
||||
|
@ -281,6 +281,6 @@ let alias_keys cctxt name =
|
||||
in find_key l
|
||||
|
||||
let force_switch () =
|
||||
Cli_entries.switch
|
||||
Clic.switch
|
||||
~long:"force" ~short:'f'
|
||||
~doc:"overwrite existing keys" ()
|
||||
|
@ -139,4 +139,4 @@ val get_keys:
|
||||
#Client_context.io_wallet ->
|
||||
(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
|
||||
|
@ -64,7 +64,7 @@ module Tags (Entity : Entity) = struct
|
||||
let desc =
|
||||
desc ^ "\n"
|
||||
^ "can be one or multiple tags separated by commas" in
|
||||
Cli_entries.(
|
||||
Clic.(
|
||||
param ~name ~desc
|
||||
(parameter (fun _ s -> of_source s))
|
||||
next)
|
||||
|
@ -28,8 +28,8 @@ module Tags (Entity : Entity) : sig
|
||||
val tag_param:
|
||||
?name:string ->
|
||||
?desc:string ->
|
||||
('a, 'ctx) Cli_entries.params ->
|
||||
(Tag.t -> 'a, 'ctx) Cli_entries.params
|
||||
('a, 'ctx) Clic.params ->
|
||||
(Tag.t -> 'a, 'ctx) Clic.params
|
||||
|
||||
val rev_find_by_tag:
|
||||
#Client_context.full ->
|
||||
|
@ -122,7 +122,7 @@ let default_cli_args = {
|
||||
}
|
||||
|
||||
|
||||
open Cli_entries
|
||||
open Clic
|
||||
|
||||
let string_parameter () : (string, #Client_context.full) parameter =
|
||||
parameter (fun _ x -> return x)
|
||||
@ -230,8 +230,8 @@ let read_config_file config_file =
|
||||
let default_config_file_name = "config"
|
||||
|
||||
let commands config_file cfg =
|
||||
let open Cli_entries in
|
||||
let group = { Cli_entries.name = "config" ;
|
||||
let open Clic in
|
||||
let group = { Clic.name = "config" ;
|
||||
title = "Commands for editing and viewing the client's config file" } in
|
||||
[ command ~group ~desc:"Show the config file."
|
||||
no_options
|
||||
|
@ -12,7 +12,7 @@
|
||||
open Client_context_unix
|
||||
|
||||
let builtin_commands =
|
||||
let open Cli_entries in
|
||||
let open Clic in
|
||||
[
|
||||
command
|
||||
~desc: "List the protocol versions that this client understands."
|
||||
@ -69,10 +69,10 @@ let main select_commands =
|
||||
| _ :: args -> move_autocomplete_token_upfront [] args
|
||||
| [] -> [], None in
|
||||
Random.self_init () ;
|
||||
ignore Cli_entries.(setup_formatter Format.std_formatter
|
||||
(if Unix.isatty Unix.stdout then Ansi else Plain) Short) ;
|
||||
ignore Cli_entries.(setup_formatter Format.err_formatter
|
||||
(if Unix.isatty Unix.stderr then Ansi else Plain) Short) ;
|
||||
ignore Clic.(setup_formatter Format.std_formatter
|
||||
(if Unix.isatty Unix.stdout then Ansi else Plain) Short) ;
|
||||
ignore Clic.(setup_formatter Format.err_formatter
|
||||
(if Unix.isatty Unix.stderr then Ansi else Plain) Short) ;
|
||||
init_logger () >>= fun () ->
|
||||
Lwt.catch begin fun () -> begin
|
||||
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
|
||||
select_commands ctxt parsed_args >>=? fun commands ->
|
||||
let commands =
|
||||
Cli_entries.add_manual
|
||||
Clic.add_manual
|
||||
~executable_name
|
||||
~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
|
||||
(config_commands @ builtin_commands @ commands) in
|
||||
let rpc_config =
|
||||
@ -112,26 +112,26 @@ let main select_commands =
|
||||
~rpc_config:rpc_config in
|
||||
begin match autocomplete with
|
||||
| Some (prev_arg, cur_arg, script) ->
|
||||
Cli_entries.autocompletion
|
||||
Clic.autocompletion
|
||||
~script ~cur_arg ~prev_arg ~args:original_args ~global_options
|
||||
commands client_config >>=? fun completions ->
|
||||
List.iter print_endline completions ;
|
||||
return ()
|
||||
| None ->
|
||||
Cli_entries.dispatch commands client_config remaining
|
||||
Clic.dispatch commands client_config remaining
|
||||
end
|
||||
end >>= function
|
||||
| Ok () ->
|
||||
Lwt.return 0
|
||||
| Error [ Cli_entries.Help command ] ->
|
||||
Cli_entries.usage
|
||||
| Error [ Clic.Help command ] ->
|
||||
Clic.usage
|
||||
Format.std_formatter
|
||||
~executable_name
|
||||
~global_options
|
||||
(match command with None -> [] | Some c -> [ c ]) ;
|
||||
Lwt.return 0
|
||||
| Error errs ->
|
||||
Cli_entries.pp_cli_errors
|
||||
Clic.pp_cli_errors
|
||||
Format.err_formatter
|
||||
~executable_name
|
||||
~global_options
|
||||
|
@ -10,5 +10,5 @@
|
||||
val run :
|
||||
(RPC_client.http_ctxt ->
|
||||
Client_config.cli_args ->
|
||||
Client_context.full Cli_entries.command list tzresult Lwt.t) ->
|
||||
Client_context.full Clic.command list tzresult Lwt.t) ->
|
||||
unit
|
||||
|
@ -8,7 +8,7 @@
|
||||
(**************************************************************************)
|
||||
|
||||
let commands () =
|
||||
let open Cli_entries in
|
||||
let open Clic in
|
||||
let group = { name = "admin" ;
|
||||
title = "Commands to perform privileged operations on the node" } in
|
||||
[
|
||||
|
@ -7,4 +7,4 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
val commands : unit -> #Client_context.full Cli_entries.command list
|
||||
val commands : unit -> #Client_context.full Clic.command list
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
open Client_context
|
||||
|
||||
type command = full Cli_entries.command
|
||||
type command = full Clic.command
|
||||
|
||||
exception Version_not_found
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
open Client_context
|
||||
|
||||
type command = full Cli_entries.command
|
||||
type command = full Clic.command
|
||||
|
||||
exception Version_not_found
|
||||
|
||||
|
@ -8,13 +8,13 @@
|
||||
(**************************************************************************)
|
||||
|
||||
let unique_switch =
|
||||
Cli_entries.switch
|
||||
Clic.switch
|
||||
~long:"unique"
|
||||
~short:'u'
|
||||
~doc:"Fail when there is more than one possible completion."
|
||||
()
|
||||
|
||||
let commands () = Cli_entries.[
|
||||
let commands () = Clic.[
|
||||
command
|
||||
~desc: "Autocomplete a prefix of Base58Check-encoded hash.\n\
|
||||
This actually works only for blocks, operations, public \
|
||||
|
@ -10,11 +10,11 @@
|
||||
open Client_keys
|
||||
|
||||
let group =
|
||||
{ Cli_entries.name = "keys" ;
|
||||
{ Clic.name = "keys" ;
|
||||
title = "Commands for managing the wallet of cryptographic keys" }
|
||||
|
||||
let commands () =
|
||||
let open Cli_entries in
|
||||
let open Clic in
|
||||
let show_private_switch =
|
||||
switch
|
||||
~long:"show-secret"
|
||||
@ -195,7 +195,7 @@ let commands () =
|
||||
else return ()) ;
|
||||
|
||||
command ~group ~desc: "Forget the entire wallet of keys."
|
||||
(args1 (Cli_entries.switch
|
||||
(args1 (Clic.switch
|
||||
~long:"force" ~short:'f'
|
||||
~doc:"you got to use the force for that" ()))
|
||||
(fixed [ "forget" ; "all" ; "keys" ])
|
||||
|
@ -8,11 +8,11 @@
|
||||
(**************************************************************************)
|
||||
|
||||
let group =
|
||||
{ Cli_entries.name = "p2p" ;
|
||||
{ Clic.name = "p2p" ;
|
||||
title = "Commands for monitoring and controlling p2p-layer state" }
|
||||
|
||||
let commands () = [
|
||||
let open Cli_entries in
|
||||
let open Clic in
|
||||
command ~group ~desc: "show global network status"
|
||||
no_options
|
||||
(prefixes ["p2p" ; "stat"] stop) begin fun () (cctxt : #Client_context.full) ->
|
||||
|
@ -41,7 +41,7 @@ let print_rejected ppf = function
|
||||
invalid
|
||||
|
||||
let commands () =
|
||||
let open Cli_entries in
|
||||
let open Clic in
|
||||
let group = { name = "report" ;
|
||||
title = "Commands to report the node's status" } in
|
||||
let output_arg =
|
||||
@ -55,7 +55,7 @@ let commands () =
|
||||
| "-" -> return Format.std_formatter
|
||||
| file ->
|
||||
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
|
||||
[
|
||||
command ~group
|
||||
|
@ -8,4 +8,4 @@
|
||||
(**************************************************************************)
|
||||
|
||||
|
||||
val commands : unit -> #Client_context.full Cli_entries.command list
|
||||
val commands : unit -> #Client_context.full Clic.command list
|
||||
|
@ -10,7 +10,7 @@
|
||||
let select_commands _ _ =
|
||||
return
|
||||
(List.map
|
||||
(Cli_entries.map_command (new Proto_alpha.wrap_full))
|
||||
(Clic.map_command (new Proto_alpha.wrap_full))
|
||||
(Client_baking_commands.commands ()))
|
||||
|
||||
let () = Client_main_run.run select_commands
|
||||
|
@ -11,11 +11,11 @@ open Client_proto_args
|
||||
open Client_baking_lib
|
||||
|
||||
let group =
|
||||
{ Cli_entries.name = "delegate" ;
|
||||
{ Clic.name = "delegate" ;
|
||||
title = "Commands related to delegate operations." }
|
||||
|
||||
let commands () =
|
||||
let open Cli_entries in
|
||||
let open Clic in
|
||||
[
|
||||
command ~group ~desc: "Launch a daemon that handles delegate operations."
|
||||
(args5 max_priority_arg endorsement_delay_arg
|
||||
|
@ -7,4 +7,4 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
val commands: unit -> Proto_alpha.full Cli_entries.command list
|
||||
val commands: unit -> Proto_alpha.full Clic.command list
|
||||
|
@ -9,5 +9,5 @@
|
||||
|
||||
let () =
|
||||
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 ()
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
open Proto_alpha
|
||||
open Alpha_context
|
||||
open Cli_entries
|
||||
open Clic
|
||||
|
||||
type error += Bad_tez_arg of string * string (* Arg_name * value *)
|
||||
type error += Bad_max_priority of string
|
||||
@ -130,7 +130,7 @@ let tez_arg ~default ~parameter ~doc =
|
||||
(tez_parameter ("--" ^ parameter))
|
||||
|
||||
let tez_param ~name ~desc next =
|
||||
Cli_entries.param
|
||||
Clic.param
|
||||
~name
|
||||
~desc:(desc ^ " in \xEA\x9C\xA9\n" ^ tez_format)
|
||||
(tez_parameter name)
|
||||
|
@ -12,36 +12,36 @@ open Alpha_context
|
||||
|
||||
val tez_sym: string
|
||||
|
||||
val init_arg: (string, Proto_alpha.full) Cli_entries.arg
|
||||
val fee_arg: (Tez.t, Proto_alpha.full) Cli_entries.arg
|
||||
val arg_arg: (string, Proto_alpha.full) Cli_entries.arg
|
||||
val source_arg: (string option, Proto_alpha.full) Cli_entries.arg
|
||||
val init_arg: (string, Proto_alpha.full) Clic.arg
|
||||
val fee_arg: (Tez.t, Proto_alpha.full) Clic.arg
|
||||
val arg_arg: (string, Proto_alpha.full) Clic.arg
|
||||
val source_arg: (string option, Proto_alpha.full) Clic.arg
|
||||
|
||||
val delegate_arg: (string option, Proto_alpha.full) Cli_entries.arg
|
||||
val delegatable_switch: (bool, Proto_alpha.full) Cli_entries.arg
|
||||
val spendable_switch: (bool, Proto_alpha.full) Cli_entries.arg
|
||||
val max_priority_arg: (int option, Proto_alpha.full) Cli_entries.arg
|
||||
val free_baking_switch: (bool, Proto_alpha.full) Cli_entries.arg
|
||||
val force_switch: (bool, Proto_alpha.full) Cli_entries.arg
|
||||
val endorsement_delay_arg: (int, Proto_alpha.full) Cli_entries.arg
|
||||
val delegate_arg: (string option, Proto_alpha.full) Clic.arg
|
||||
val delegatable_switch: (bool, Proto_alpha.full) Clic.arg
|
||||
val spendable_switch: (bool, Proto_alpha.full) Clic.arg
|
||||
val max_priority_arg: (int option, Proto_alpha.full) Clic.arg
|
||||
val free_baking_switch: (bool, Proto_alpha.full) Clic.arg
|
||||
val force_switch: (bool, Proto_alpha.full) Clic.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 :
|
||||
default:string ->
|
||||
parameter:string ->
|
||||
doc:string ->
|
||||
(Tez.t, Proto_alpha.full) Cli_entries.arg
|
||||
(Tez.t, Proto_alpha.full) Clic.arg
|
||||
val tez_param :
|
||||
name:string ->
|
||||
desc:string ->
|
||||
('a, full) Cli_entries.params ->
|
||||
(Tez.t -> 'a, full) Cli_entries.params
|
||||
('a, full) Clic.params ->
|
||||
(Tez.t -> 'a, full) Clic.params
|
||||
|
||||
module Daemon : sig
|
||||
val baking_switch: (bool, Proto_alpha.full) Cli_entries.arg
|
||||
val endorsement_switch: (bool, Proto_alpha.full) Cli_entries.arg
|
||||
val denunciation_switch: (bool, Proto_alpha.full) Cli_entries.arg
|
||||
val baking_switch: (bool, Proto_alpha.full) Clic.arg
|
||||
val endorsement_switch: (bool, Proto_alpha.full) Clic.arg
|
||||
val denunciation_switch: (bool, Proto_alpha.full) Clic.arg
|
||||
end
|
||||
|
||||
val string_parameter : (string, full) Cli_entries.parameter
|
||||
val string_parameter : (string, full) Clic.parameter
|
||||
|
@ -66,7 +66,7 @@ module ContractAlias = struct
|
||||
desc ^ "\n"
|
||||
^ "Can be a contract alias or a key alias (autodetected in order).\n\
|
||||
Use 'key:name' to force the later." in
|
||||
Cli_entries.(
|
||||
Clic.(
|
||||
param ~name ~desc
|
||||
(parameter ~autocomplete:autocomplete
|
||||
(fun cctxt p -> get_contract cctxt p))
|
||||
@ -77,7 +77,7 @@ module ContractAlias = struct
|
||||
desc ^ "\n"
|
||||
^ "Can be an alias, a key, or a literal (autodetected in order).\n\
|
||||
Use 'text:literal', 'alias:name', 'key:name' to force." in
|
||||
Cli_entries.(
|
||||
Clic.(
|
||||
param ~name ~desc
|
||||
(parameter
|
||||
~autocomplete:(fun cctxt ->
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
open Proto_alpha
|
||||
open Alpha_context
|
||||
open Cli_entries
|
||||
open Clic
|
||||
|
||||
module RawContractAlias :
|
||||
Client_aliases.Alias with type t = Contract.t
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
let () =
|
||||
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_contracts_commands.commands () @
|
||||
Client_proto_context_commands.commands ()
|
||||
|
@ -81,15 +81,15 @@ let wait_for_operation_inclusion
|
||||
return ()
|
||||
|
||||
let group =
|
||||
{ Cli_entries.name = "context" ;
|
||||
{ Clic.name = "context" ;
|
||||
title = "Block contextual commands (see option -block)" }
|
||||
|
||||
let alphanet =
|
||||
{ Cli_entries.name = "alphanet" ;
|
||||
{ Clic.name = "alphanet" ;
|
||||
title = "Alphanet only commands" }
|
||||
|
||||
let commands () =
|
||||
let open Cli_entries in
|
||||
let open Clic in
|
||||
[
|
||||
command ~group ~desc: "Access the timestamp of the block."
|
||||
no_options
|
||||
|
@ -12,11 +12,11 @@ open Alpha_context
|
||||
open Client_proto_contracts
|
||||
|
||||
let group =
|
||||
{ Cli_entries.name = "contracts" ;
|
||||
{ Clic.name = "contracts" ;
|
||||
title = "Commands for managing the record of known contracts" }
|
||||
|
||||
let commands () =
|
||||
let open Cli_entries in
|
||||
let open Clic in
|
||||
[
|
||||
|
||||
command ~group ~desc: "Add a contract to the wallet."
|
||||
|
@ -10,7 +10,7 @@
|
||||
open Proto_alpha
|
||||
|
||||
let group =
|
||||
{ Cli_entries.name = "programs" ;
|
||||
{ Clic.name = "programs" ;
|
||||
title = "Commands for managing the library of known programs" }
|
||||
|
||||
open Tezos_micheline
|
||||
@ -18,7 +18,7 @@ open Client_proto_programs
|
||||
open Client_proto_args
|
||||
|
||||
let commands () =
|
||||
let open Cli_entries in
|
||||
let open Clic in
|
||||
let show_types_switch =
|
||||
switch
|
||||
~long:"details"
|
||||
@ -42,7 +42,7 @@ let commands () =
|
||||
~doc:"amount of the transfer in \xEA\x9C\xA9"
|
||||
~default:"0.05" in
|
||||
let data_parameter =
|
||||
Cli_entries.parameter (fun _ data ->
|
||||
Clic.parameter (fun _ data ->
|
||||
Lwt.return (Micheline_parser.no_parsing_error
|
||||
@@ Michelson_v1_parser.parse_expression data)) in
|
||||
[
|
||||
@ -87,10 +87,10 @@ let commands () =
|
||||
(prefixes [ "run" ; "program" ]
|
||||
@@ Program.source_param
|
||||
@@ prefixes [ "on" ; "storage" ]
|
||||
@@ Cli_entries.param ~name:"storage" ~desc:"the storage data"
|
||||
@@ Clic.param ~name:"storage" ~desc:"the storage data"
|
||||
data_parameter
|
||||
@@ prefixes [ "and" ; "input" ]
|
||||
@@ Cli_entries.param ~name:"storage" ~desc:"the input data"
|
||||
@@ Clic.param ~name:"storage" ~desc:"the input data"
|
||||
data_parameter
|
||||
@@ stop)
|
||||
(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."
|
||||
(args1 no_print_source_flag)
|
||||
(prefixes [ "typecheck" ; "data" ]
|
||||
@@ Cli_entries.param ~name:"data" ~desc:"the data to typecheck"
|
||||
@@ Clic.param ~name:"data" ~desc:"the data to typecheck"
|
||||
data_parameter
|
||||
@@ prefixes [ "against" ; "type" ]
|
||||
@@ Cli_entries.param ~name:"type" ~desc:"the expected type"
|
||||
@@ Clic.param ~name:"type" ~desc:"the expected type"
|
||||
data_parameter
|
||||
@@ stop)
|
||||
(fun no_print_source data ty cctxt ->
|
||||
@ -162,10 +162,10 @@ let commands () =
|
||||
instruction `H` would have produced."
|
||||
no_options
|
||||
(prefixes [ "hash" ; "data" ]
|
||||
@@ Cli_entries.param ~name:"data" ~desc:"the data to hash"
|
||||
@@ Clic.param ~name:"data" ~desc:"the data to hash"
|
||||
data_parameter
|
||||
@@ prefixes [ "of" ; "type" ]
|
||||
@@ Cli_entries.param ~name:"type" ~desc:"type of the data"
|
||||
@@ Clic.param ~name:"type" ~desc:"type of the data"
|
||||
data_parameter
|
||||
@@ stop)
|
||||
(fun () data typ cctxt ->
|
||||
@ -186,10 +186,10 @@ let commands () =
|
||||
instruction `CHECK_SIGNATURE`."
|
||||
no_options
|
||||
(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
|
||||
@@ prefixes [ "of" ; "type" ]
|
||||
@@ Cli_entries.param ~name:"type" ~desc:"type of the data"
|
||||
@@ Clic.param ~name:"type" ~desc:"type of the data"
|
||||
data_parameter
|
||||
@@ prefixes [ "for" ]
|
||||
@@ Client_keys.Secret_key.alias_param
|
||||
|
@ -7,4 +7,4 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
val commands: unit -> Proto_alpha.full Cli_entries.command list
|
||||
val commands: unit -> Proto_alpha.full Clic.command list
|
||||
|
@ -66,7 +66,7 @@ let handle_error cctxt = function
|
||||
cctxt.Client_commands.error "%s" "cannot continue"
|
||||
|
||||
let commands () =
|
||||
let open Cli_entries in
|
||||
let open Clic in
|
||||
let group = {name = "demo" ; title = "Some demo command" } in
|
||||
[
|
||||
command ~group ~desc: "A demo command"
|
||||
|
@ -25,17 +25,17 @@ let bake cctxt ?(timestamp = Time.now ()) block command sk =
|
||||
Shell_services.inject_block cctxt signed_blk []
|
||||
|
||||
let int64_parameter =
|
||||
(Cli_entries.parameter (fun _ p ->
|
||||
(Clic.parameter (fun _ p ->
|
||||
try return (Int64.of_string p)
|
||||
with _ -> failwith "Cannot read int64"))
|
||||
|
||||
let int_parameter =
|
||||
(Cli_entries.parameter (fun _ p ->
|
||||
(Clic.parameter (fun _ p ->
|
||||
try return (int_of_string p)
|
||||
with _ -> failwith "Cannot read int"))
|
||||
|
||||
let commands () =
|
||||
let open Cli_entries in
|
||||
let open Clic in
|
||||
let args =
|
||||
args1
|
||||
(arg
|
||||
|
Loading…
Reference in New Issue
Block a user