From dd1b200306edab2c8392a3f6ee743551f5626775 Mon Sep 17 00:00:00 2001 From: Benjamin Canou Date: Wed, 14 Feb 2018 15:54:52 +0100 Subject: [PATCH] Client: split client-base into client-base and client-commands --- src/bin_client/client_config.ml | 2 +- src/bin_client/jbuild | 2 ++ src/lib_client_base/client_aliases.ml | 3 ++- src/lib_client_base/client_keys.ml | 4 +++- .../client_admin_commands.ml | 0 .../client_admin_commands.mli | 0 .../client_commands.ml | 3 --- .../client_commands.mli | 4 ---- .../client_helpers_commands.ml | 0 .../client_helpers_commands.mli | 0 .../client_keys_commands.ml | 4 +++- .../client_keys_commands.mli | 0 .../client_network_commands.ml | 0 .../client_network_commands.mli | 0 .../client_report_commands.ml | 0 .../client_report_commands.mli | 0 src/lib_client_commands/jbuild | 21 ++++++++++++++++ .../tezos-client-commands.opam | 24 +++++++++++++++++++ src/proto_alpha/lib_client/jbuild | 2 ++ src/proto_genesis/lib_client/jbuild | 4 +++- .../lib_client/tezos-client-genesis.opam | 1 + 21 files changed, 62 insertions(+), 12 deletions(-) rename src/{lib_client_base => lib_client_commands}/client_admin_commands.ml (100%) rename src/{lib_client_base => lib_client_commands}/client_admin_commands.mli (100%) rename src/{lib_client_base => lib_client_commands}/client_commands.ml (90%) rename src/{lib_client_base => lib_client_commands}/client_commands.mli (82%) rename src/{lib_client_base => lib_client_commands}/client_helpers_commands.ml (100%) rename src/{lib_client_base => lib_client_commands}/client_helpers_commands.mli (100%) rename src/{lib_client_base => lib_client_commands}/client_keys_commands.ml (98%) rename src/{lib_client_base => lib_client_commands}/client_keys_commands.mli (100%) rename src/{lib_client_base => lib_client_commands}/client_network_commands.ml (100%) rename src/{lib_client_base => lib_client_commands}/client_network_commands.mli (100%) rename src/{lib_client_base => lib_client_commands}/client_report_commands.ml (100%) rename src/{lib_client_base => lib_client_commands}/client_report_commands.mli (100%) create mode 100644 src/lib_client_commands/jbuild create mode 100644 src/lib_client_commands/tezos-client-commands.opam diff --git a/src/bin_client/client_config.ml b/src/bin_client/client_config.ml index c518292bc..0e833e582 100644 --- a/src/bin_client/client_config.ml +++ b/src/bin_client/client_config.ml @@ -230,7 +230,7 @@ let default_config_file_name = "config" let commands config_file cfg = let open Cli_entries in let group = { Cli_entries.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." no_options (fixed [ "config" ; "show" ]) diff --git a/src/bin_client/jbuild b/src/bin_client/jbuild index f7cb3d5f9..9c233edd2 100644 --- a/src/bin_client/jbuild +++ b/src/bin_client/jbuild @@ -7,6 +7,7 @@ tezos-rpc-http tezos-shell-services tezos-client-base + tezos-client-commands tezos-client-genesis tezos-stdlib-unix tezos-unix-signers @@ -18,6 +19,7 @@ -open Tezos_stdlib_unix -open Tezos_shell_services -open Tezos_client_base + -open Tezos_client_commands -open Tezos_unix_signers)))) (install diff --git a/src/lib_client_base/client_aliases.ml b/src/lib_client_base/client_aliases.ml index fb59ce844..380cdedf6 100644 --- a/src/lib_client_base/client_aliases.ml +++ b/src/lib_client_base/client_aliases.ml @@ -266,7 +266,8 @@ module Alias = functor (Entity : Entity) -> struct next let force_switch () = - Client_commands.force_switch + Cli_entries.switch + ~long:"force" ~short:'f' ~doc:("overwrite existing " ^ Entity.name) () let name (wallet : #wallet) d = diff --git a/src/lib_client_base/client_keys.ml b/src/lib_client_base/client_keys.ml index 6e7d8a842..ea3919cb7 100644 --- a/src/lib_client_base/client_keys.ml +++ b/src/lib_client_base/client_keys.ml @@ -280,4 +280,6 @@ let alias_keys cctxt name = in find_key l let force_switch () = - Client_commands.force_switch ~doc:"overwrite existing keys" () + Cli_entries.switch + ~long:"force" ~short:'f' + ~doc:"overwrite existing keys" () diff --git a/src/lib_client_base/client_admin_commands.ml b/src/lib_client_commands/client_admin_commands.ml similarity index 100% rename from src/lib_client_base/client_admin_commands.ml rename to src/lib_client_commands/client_admin_commands.ml diff --git a/src/lib_client_base/client_admin_commands.mli b/src/lib_client_commands/client_admin_commands.mli similarity index 100% rename from src/lib_client_base/client_admin_commands.mli rename to src/lib_client_commands/client_admin_commands.mli diff --git a/src/lib_client_base/client_commands.ml b/src/lib_client_commands/client_commands.ml similarity index 90% rename from src/lib_client_base/client_commands.ml rename to src/lib_client_commands/client_commands.ml index fad0e07a1..79ddb0a52 100644 --- a/src/lib_client_base/client_commands.ml +++ b/src/lib_client_commands/client_commands.ml @@ -30,6 +30,3 @@ let register name commands = let commands_for_version version = try Protocol_hash.Table.find versions version with Not_found -> raise Version_not_found - -let force_switch ?(doc = "Silence any warnings and some checks.") () = - Cli_entries.switch ~long:"force" ~short:'f' ~doc () diff --git a/src/lib_client_base/client_commands.mli b/src/lib_client_commands/client_commands.mli similarity index 82% rename from src/lib_client_base/client_commands.mli rename to src/lib_client_commands/client_commands.mli index 094b208a9..5b94c5cfb 100644 --- a/src/lib_client_base/client_commands.mli +++ b/src/lib_client_commands/client_commands.mli @@ -16,7 +16,3 @@ exception Version_not_found val register: Protocol_hash.t -> command list -> unit val commands_for_version: Protocol_hash.t -> command list val get_versions: unit -> (Protocol_hash.t * (command list)) list - -(** Have a command execute ignoring warnings. - Default doc is ["Silence any warnings and some checks."]. *) -val force_switch : ?doc:string -> unit -> (bool, #full_context) Cli_entries.arg diff --git a/src/lib_client_base/client_helpers_commands.ml b/src/lib_client_commands/client_helpers_commands.ml similarity index 100% rename from src/lib_client_base/client_helpers_commands.ml rename to src/lib_client_commands/client_helpers_commands.ml diff --git a/src/lib_client_base/client_helpers_commands.mli b/src/lib_client_commands/client_helpers_commands.mli similarity index 100% rename from src/lib_client_base/client_helpers_commands.mli rename to src/lib_client_commands/client_helpers_commands.mli diff --git a/src/lib_client_base/client_keys_commands.ml b/src/lib_client_commands/client_keys_commands.ml similarity index 98% rename from src/lib_client_base/client_keys_commands.ml rename to src/lib_client_commands/client_keys_commands.ml index 77ae93247..66a9bd968 100644 --- a/src/lib_client_base/client_keys_commands.ml +++ b/src/lib_client_commands/client_keys_commands.ml @@ -195,7 +195,9 @@ let commands () = else return ()) ; command ~group ~desc: "Forget the entire wallet of keys." - (args1 (Client_commands.force_switch ~doc:"you got to use the force for that" ())) + (args1 (Cli_entries.switch + ~long:"force" ~short:'f' + ~doc:"you got to use the force for that" ())) (fixed [ "forget" ; "all" ; "keys" ]) (fun force cctxt -> fail_unless force diff --git a/src/lib_client_base/client_keys_commands.mli b/src/lib_client_commands/client_keys_commands.mli similarity index 100% rename from src/lib_client_base/client_keys_commands.mli rename to src/lib_client_commands/client_keys_commands.mli diff --git a/src/lib_client_base/client_network_commands.ml b/src/lib_client_commands/client_network_commands.ml similarity index 100% rename from src/lib_client_base/client_network_commands.ml rename to src/lib_client_commands/client_network_commands.ml diff --git a/src/lib_client_base/client_network_commands.mli b/src/lib_client_commands/client_network_commands.mli similarity index 100% rename from src/lib_client_base/client_network_commands.mli rename to src/lib_client_commands/client_network_commands.mli diff --git a/src/lib_client_base/client_report_commands.ml b/src/lib_client_commands/client_report_commands.ml similarity index 100% rename from src/lib_client_base/client_report_commands.ml rename to src/lib_client_commands/client_report_commands.ml diff --git a/src/lib_client_base/client_report_commands.mli b/src/lib_client_commands/client_report_commands.mli similarity index 100% rename from src/lib_client_base/client_report_commands.mli rename to src/lib_client_commands/client_report_commands.mli diff --git a/src/lib_client_commands/jbuild b/src/lib_client_commands/jbuild new file mode 100644 index 000000000..41c0e08db --- /dev/null +++ b/src/lib_client_commands/jbuild @@ -0,0 +1,21 @@ +(jbuild_version 1) + +(library + ((name tezos_client_commands) + (public_name tezos-client-commands) + (libraries (tezos-base + tezos-client-base + tezos-rpc + tezos-shell-services)) + (library_flags (:standard -linkall)) + (flags (:standard -w -9+27-30-32-40@8 + -safe-string + -open Tezos_base__TzPervasives + -open Tezos_rpc + -open Tezos_client_base + -open Tezos_shell_services)))) + +(alias + ((name runtest_indent) + (deps ((glob_files *.ml*))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/lib_client_commands/tezos-client-commands.opam b/src/lib_client_commands/tezos-client-commands.opam new file mode 100644 index 000000000..2c23a5424 --- /dev/null +++ b/src/lib_client_commands/tezos-client-commands.opam @@ -0,0 +1,24 @@ +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+beta17" } + "tezos-base" + "tezos-stdlib-unix" + "tezos-shell-services" + "tezos-storage" + "tezos-rpc-http" + "tezos-client-base" +] +build: [ + [ "jbuilder" "build" "-p" name "-j" jobs ] +] +build-test: [ + [ "jbuilder" "runtest" "-p" name "-j" jobs ] +] diff --git a/src/proto_alpha/lib_client/jbuild b/src/proto_alpha/lib_client/jbuild index cc6a4157e..9c8402d07 100644 --- a/src/proto_alpha/lib_client/jbuild +++ b/src/proto_alpha/lib_client/jbuild @@ -8,6 +8,7 @@ tezos-protocol-environment-client tezos-shell-services tezos-client-base + tezos-client-commands tezos-rpc)) (library_flags (:standard -linkall)) (flags (:standard -w -9+27-30-32-40@8 @@ -15,6 +16,7 @@ -open Tezos_base__TzPervasives -open Tezos_shell_services -open Tezos_client_base + -open Tezos_client_commands -open Tezos_rpc)))) (alias diff --git a/src/proto_genesis/lib_client/jbuild b/src/proto_genesis/lib_client/jbuild index 2c460469e..eccd02624 100644 --- a/src/proto_genesis/lib_client/jbuild +++ b/src/proto_genesis/lib_client/jbuild @@ -6,6 +6,7 @@ (libraries (tezos-base tezos-shell-services tezos-client-base + tezos-client-commands tezos-protocol-environment-client tezos-protocol-genesis tezos-protocol-alpha)) @@ -14,7 +15,8 @@ -safe-string -open Tezos_base__TzPervasives -open Tezos_shell_services - -open Tezos_client_base)))) + -open Tezos_client_base + -open Tezos_client_commands)))) (alias ((name runtest_indent) diff --git a/src/proto_genesis/lib_client/tezos-client-genesis.opam b/src/proto_genesis/lib_client/tezos-client-genesis.opam index 4d1b5d3de..b7b12e77e 100644 --- a/src/proto_genesis/lib_client/tezos-client-genesis.opam +++ b/src/proto_genesis/lib_client/tezos-client-genesis.opam @@ -12,6 +12,7 @@ depends: [ "tezos-base" "tezos-shell-services" "tezos-client-base" + "tezos-client-commands" "tezos-protocol-environment-client" "tezos-protocol-genesis" "tezos-protocol-alpha"