Commit a91680d8 authored by Raphaël Cauderlier's avatar Raphaël Cauderlier

Client/Michelson: command for macro expansion

This adds a client command to expand all macros in a Michelson script.
parent 4f460e91
Pipeline #108082741 passed with stages
in 30 minutes and 13 seconds
......@@ -539,4 +539,19 @@ let commands () =
ppf
errors)
()
>>= fun () -> cctxt#error "syntax error in program") ]
>>= fun () -> cctxt#error "syntax error in program");
command
~group
~desc:"Ask the node to expand the Michelson macros in a script."
no_options
(prefixes ["expand"; "macros"; "in"] @@ Program.source_param @@ stop)
(fun () program (cctxt : Protocol_client_context.full) ->
Lwt.return @@ Micheline_parser.no_parsing_error program
>>=? fun program ->
cctxt#message
"%a"
(fun ppf () ->
( Michelson_v1_printer.print_expr_unwrapped ppf program.expanded
: unit ))
()
>>= fun () -> return_unit) ]
......@@ -539,4 +539,19 @@ let commands () =
ppf
errors)
()
>>= fun () -> cctxt#error "syntax error in program") ]
>>= fun () -> cctxt#error "syntax error in program");
command
~group
~desc:"Ask the node to expand the Michelson macros in a script."
no_options
(prefixes ["expand"; "macros"; "in"] @@ Program.source_param @@ stop)
(fun () program (cctxt : Protocol_client_context.full) ->
Lwt.return @@ Micheline_parser.no_parsing_error program
>>=? fun program ->
cctxt#message
"%a"
(fun ppf () ->
( Michelson_v1_printer.print_expr_unwrapped ppf program.expanded
: unit ))
()
>>= fun () -> return_unit) ]
......@@ -539,4 +539,19 @@ let commands () =
ppf
errors)
()
>>= fun () -> cctxt#error "syntax error in program") ]
>>= fun () -> cctxt#error "syntax error in program");
command
~group
~desc:"Ask the node to expand the Michelson macros in a script."
no_options
(prefixes ["expand"; "macros"; "in"] @@ Program.source_param @@ stop)
(fun () program (cctxt : Protocol_client_context.full) ->
Lwt.return @@ Micheline_parser.no_parsing_error program
>>=? fun program ->
cctxt#message
"%a"
(fun ppf () ->
( Michelson_v1_printer.print_expr_unwrapped ppf program.expanded
: unit ))
()
>>= fun () -> return_unit) ]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment