2016-10-16 23:57:56 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
2018-02-06 00:17:03 +04:00
|
|
|
(* Copyright (c) 2014 - 2018. *)
|
2016-10-16 23:57:56 +04:00
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
2017-09-19 13:31:35 +04:00
|
|
|
let unique_switch =
|
|
|
|
Cli_entries.switch
|
|
|
|
~parameter:"-unique"
|
|
|
|
~doc:"Fail when there is more than one possible completion."
|
2016-10-16 23:57:56 +04:00
|
|
|
|
|
|
|
let commands () = Cli_entries.[
|
|
|
|
command
|
2018-01-29 13:43:07 +04:00
|
|
|
~desc: "Autocomplete a prefix of Base58Check-encoded hash.\n\
|
|
|
|
This actually works only for blocks, operations, public \
|
|
|
|
key and contract identifiers."
|
2017-09-19 13:31:35 +04:00
|
|
|
(args1 unique_switch)
|
2016-12-03 16:05:02 +04:00
|
|
|
(prefixes [ "complete" ] @@
|
|
|
|
string
|
|
|
|
~name: "prefix"
|
2018-01-29 13:43:07 +04:00
|
|
|
~desc: "the prefix of the hash to complete" @@
|
2016-12-03 16:05:02 +04:00
|
|
|
stop)
|
2018-02-11 22:17:39 +04:00
|
|
|
(fun unique prefix (cctxt : #Client_commands.full_context) ->
|
2018-02-08 13:51:02 +04:00
|
|
|
Shell_services.complete
|
2017-11-07 20:38:11 +04:00
|
|
|
cctxt ~block:cctxt#block prefix >>=? fun completions ->
|
2016-10-16 23:57:56 +04:00
|
|
|
match completions with
|
|
|
|
| [] -> Pervasives.exit 3
|
2017-09-19 13:31:35 +04:00
|
|
|
| _ :: _ :: _ when unique -> Pervasives.exit 3
|
2016-10-16 23:57:56 +04:00
|
|
|
| completions ->
|
|
|
|
List.iter print_endline completions ;
|
2017-04-05 01:35:41 +04:00
|
|
|
return ()) ;
|
2017-02-28 03:48:22 +04:00
|
|
|
command
|
|
|
|
~desc: "Wait for the node to be bootstrapped."
|
2017-09-19 13:31:35 +04:00
|
|
|
no_options
|
2017-02-28 03:48:22 +04:00
|
|
|
(prefixes [ "bootstrapped" ] @@
|
|
|
|
stop)
|
2018-02-11 22:17:39 +04:00
|
|
|
(fun () (cctxt : #Client_commands.full_context) ->
|
2018-02-08 13:51:02 +04:00
|
|
|
Shell_services.bootstrapped cctxt >>=? fun (stream, _) ->
|
2017-12-09 01:08:29 +04:00
|
|
|
Lwt_stream.iter_s
|
|
|
|
(fun (hash, time) ->
|
|
|
|
cctxt#message "Current head: %a (%a)"
|
|
|
|
Block_hash.pp_short hash
|
|
|
|
Time.pp_hum time) stream >>= fun () ->
|
2017-11-07 20:38:11 +04:00
|
|
|
cctxt#answer "Bootstrapped." >>= fun () ->
|
2017-04-05 01:35:41 +04:00
|
|
|
return ()
|
2017-11-13 19:34:00 +04:00
|
|
|
)
|
2016-12-03 16:05:02 +04:00
|
|
|
]
|