Client: split client-base into client-base and client-commands

This commit is contained in:
Benjamin Canou 2018-02-14 15:54:52 +01:00
parent 7e6a4a5333
commit dd1b200306
21 changed files with 62 additions and 12 deletions

View File

@ -230,7 +230,7 @@ let default_config_file_name = "config"
let commands config_file cfg = let commands config_file cfg =
let open Cli_entries in let open Cli_entries in
let group = { Cli_entries.name = "config" ; 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." [ command ~group ~desc:"Show the config file."
no_options no_options
(fixed [ "config" ; "show" ]) (fixed [ "config" ; "show" ])

View File

@ -7,6 +7,7 @@
tezos-rpc-http tezos-rpc-http
tezos-shell-services tezos-shell-services
tezos-client-base tezos-client-base
tezos-client-commands
tezos-client-genesis tezos-client-genesis
tezos-stdlib-unix tezos-stdlib-unix
tezos-unix-signers tezos-unix-signers
@ -18,6 +19,7 @@
-open Tezos_stdlib_unix -open Tezos_stdlib_unix
-open Tezos_shell_services -open Tezos_shell_services
-open Tezos_client_base -open Tezos_client_base
-open Tezos_client_commands
-open Tezos_unix_signers)))) -open Tezos_unix_signers))))
(install (install

View File

@ -266,7 +266,8 @@ module Alias = functor (Entity : Entity) -> struct
next next
let force_switch () = let force_switch () =
Client_commands.force_switch Cli_entries.switch
~long:"force" ~short:'f'
~doc:("overwrite existing " ^ Entity.name) () ~doc:("overwrite existing " ^ Entity.name) ()
let name (wallet : #wallet) d = let name (wallet : #wallet) d =

View File

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

View File

@ -30,6 +30,3 @@ let register name commands =
let commands_for_version version = let commands_for_version version =
try Protocol_hash.Table.find versions version try Protocol_hash.Table.find versions version
with Not_found -> raise Version_not_found 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 ()

View File

@ -16,7 +16,3 @@ exception Version_not_found
val register: Protocol_hash.t -> command list -> unit val register: Protocol_hash.t -> command list -> unit
val commands_for_version: Protocol_hash.t -> command list val commands_for_version: Protocol_hash.t -> command list
val get_versions: unit -> (Protocol_hash.t * (command list)) 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

View File

@ -195,7 +195,9 @@ 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 (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" ]) (fixed [ "forget" ; "all" ; "keys" ])
(fun force cctxt -> (fun force cctxt ->
fail_unless force fail_unless force

View File

@ -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} ${^}))))

View File

@ -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 ]
]

View File

@ -8,6 +8,7 @@
tezos-protocol-environment-client tezos-protocol-environment-client
tezos-shell-services tezos-shell-services
tezos-client-base tezos-client-base
tezos-client-commands
tezos-rpc)) tezos-rpc))
(library_flags (:standard -linkall)) (library_flags (:standard -linkall))
(flags (:standard -w -9+27-30-32-40@8 (flags (:standard -w -9+27-30-32-40@8
@ -15,6 +16,7 @@
-open Tezos_base__TzPervasives -open Tezos_base__TzPervasives
-open Tezos_shell_services -open Tezos_shell_services
-open Tezos_client_base -open Tezos_client_base
-open Tezos_client_commands
-open Tezos_rpc)))) -open Tezos_rpc))))
(alias (alias

View File

@ -6,6 +6,7 @@
(libraries (tezos-base (libraries (tezos-base
tezos-shell-services tezos-shell-services
tezos-client-base tezos-client-base
tezos-client-commands
tezos-protocol-environment-client tezos-protocol-environment-client
tezos-protocol-genesis tezos-protocol-genesis
tezos-protocol-alpha)) tezos-protocol-alpha))
@ -14,7 +15,8 @@
-safe-string -safe-string
-open Tezos_base__TzPervasives -open Tezos_base__TzPervasives
-open Tezos_shell_services -open Tezos_shell_services
-open Tezos_client_base)))) -open Tezos_client_base
-open Tezos_client_commands))))
(alias (alias
((name runtest_indent) ((name runtest_indent)

View File

@ -12,6 +12,7 @@ depends: [
"tezos-base" "tezos-base"
"tezos-shell-services" "tezos-shell-services"
"tezos-client-base" "tezos-client-base"
"tezos-client-commands"
"tezos-protocol-environment-client" "tezos-protocol-environment-client"
"tezos-protocol-genesis" "tezos-protocol-genesis"
"tezos-protocol-alpha" "tezos-protocol-alpha"