Client: minor refactoring

This commit is contained in:
Benjamin Canou 2018-02-14 15:33:47 +01:00
parent 5ff20bc566
commit 7e6a4a5333
2 changed files with 15 additions and 11 deletions

View File

@ -75,6 +75,20 @@ let make_context block base_dir rpc_config =
method block = block
end
let builtin_commands =
let open Cli_entries in
[
command
~desc: "List the protocol versions that this client understands."
no_options
(fixed [ "list" ; "understood" ; "protocols" ])
(fun () (cctxt : #Client_context.full_context) ->
Lwt_list.iter_s
(fun (ver, _) -> cctxt#message "%a" Protocol_hash.pp_short ver)
(Client_commands.get_versions ()) >>= fun () ->
return ()) ;
]
(* Main (lwt) entry *)
let main select_commands =
let executable_name = Filename.basename Sys.executable_name in
@ -117,7 +131,7 @@ let main select_commands =
~global_options
(if Unix.isatty Unix.stdout then Cli_entries.Ansi else Cli_entries.Plain)
Format.std_formatter
(config_commands @ commands) in
(config_commands @ builtin_commands @ commands) in
let rpc_config =
if parsed_args.print_timings then
{ rpc_config with

View File

@ -425,16 +425,6 @@ let group =
let commands = [
command
~desc: "List the protocol versions that this client understands."
no_options
(fixed [ "list" ; "versions" ])
(fun () (cctxt : #Client_context.full_context) ->
Lwt_list.iter_s
(fun (ver, _) -> cctxt#message "%a" Protocol_hash.pp_short ver)
(Client_commands.get_versions ()) >>= fun () ->
return ()) ;
command ~group
~desc: "List RPCs under a given URL prefix.\n\
Some parts of the RPC service hierarchy depend on parameters,\n\