Merge branch 'dev' of gitlab.com:ligolang/ligo into rinderknecht-dev

This commit is contained in:
Christian Rinderknecht 2019-12-13 14:53:33 +01:00
commit 2904a40373
3 changed files with 52 additions and 11 deletions

View File

@ -2,11 +2,18 @@ open Cmdliner
open Trace open Trace
open Cli_helpers open Cli_helpers
let version =
Format.asprintf
"Rolling release\nHash: %s\nDate: %s\nCI job id: %s"
Version.hash
Version.commit_date
Version.job_id
let main = let main =
let man = let man =
[ `S "MORE HELP"; [ `S "MORE HELP";
`P "Use `$(mname) $(i,COMMAND) --help' for help on a single command." ] in `P "Use `$(mname) $(i,COMMAND) --help' for help on a single command." ] in
(Term.(ret (const (`Help (`Auto, None)))), Term.info "ligo" ~man) (Term.(ret (const (`Help (`Auto, None)))), Term.info "ligo" ~version ~man)
let source_file n = let source_file n =
let open Arg in let open Arg in

View File

@ -5,13 +5,20 @@
cmdliner cmdliner
ligo ligo
) )
(modules cli cli_helpers) (modules cli cli_helpers version)
(preprocess (preprocess
(pps ppx_let) (pps ppx_let)
) )
(flags (:standard -open Simple_utils)) (flags (:standard -open Simple_utils))
) )
(rule
(targets version.ml)
(action (with-stdout-to
version.ml
(run "sh" "-c"
"printf 'let hash = \"%s\"\nlet commit_date = \"%s\"\nlet job_id = \"%s\"\n' \"$(git rev-parse HEAD)\" \"$(git show --no-patch --format=%ci)\" \"${CI_JOB_ID}\""))))
(executable (executable
(name runligo) (name runligo)
(public_name ligo) (public_name ligo)

View File

@ -51,7 +51,10 @@ let%expect_test _ =
--help[=FMT] (default=auto) --help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of `auto', Show this help in format FMT. The value FMT must be one of `auto',
`pager', `groff' or `plain'. With `auto', the format is `pager` or `pager', `groff' or `plain'. With `auto', the format is `pager` or
`plain' whenever the TERM env var is `dumb' or undefined. |} ] ; `plain' whenever the TERM env var is `dumb' or undefined.
--version
Show version information. |} ] ;
run_ligo_good [ "--help" ] ; run_ligo_good [ "--help" ] ;
[%expect {| [%expect {|
@ -102,7 +105,10 @@ let%expect_test _ =
--help[=FMT] (default=auto) --help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of `auto', Show this help in format FMT. The value FMT must be one of `auto',
`pager', `groff' or `plain'. With `auto', the format is `pager` or `pager', `groff' or `plain'. With `auto', the format is `pager` or
`plain' whenever the TERM env var is `dumb' or undefined. |} ] ; `plain' whenever the TERM env var is `dumb' or undefined.
--version
Show version information. |} ] ;
run_ligo_good [ "compile-contract" ; "--help" ] ; run_ligo_good [ "compile-contract" ; "--help" ] ;
[%expect {| [%expect {|
@ -142,7 +148,10 @@ let%expect_test _ =
-s SYNTAX, --syntax=SYNTAX (absent=auto) -s SYNTAX, --syntax=SYNTAX (absent=auto)
SYNTAX is the syntax that will be used. Currently supported SYNTAX is the syntax that will be used. Currently supported
syntaxes are "pascaligo" and "cameligo". By default, the syntax is syntaxes are "pascaligo" and "cameligo". By default, the syntax is
guessed from the extension (.ligo and .mligo, respectively). |} ] ; guessed from the extension (.ligo and .mligo, respectively).
--version
Show version information. |} ] ;
run_ligo_good [ "compile-parameter" ; "--help" ] ; run_ligo_good [ "compile-parameter" ; "--help" ] ;
[%expect {| [%expect {|
@ -188,7 +197,10 @@ let%expect_test _ =
-s SYNTAX, --syntax=SYNTAX (absent=auto) -s SYNTAX, --syntax=SYNTAX (absent=auto)
SYNTAX is the syntax that will be used. Currently supported SYNTAX is the syntax that will be used. Currently supported
syntaxes are "pascaligo" and "cameligo". By default, the syntax is syntaxes are "pascaligo" and "cameligo". By default, the syntax is
guessed from the extension (.ligo and .mligo, respectively). |} ] ; guessed from the extension (.ligo and .mligo, respectively).
--version
Show version information. |} ] ;
run_ligo_good [ "compile-storage" ; "--help" ] ; run_ligo_good [ "compile-storage" ; "--help" ] ;
[%expect {| [%expect {|
@ -235,7 +247,10 @@ let%expect_test _ =
-s SYNTAX, --syntax=SYNTAX (absent=auto) -s SYNTAX, --syntax=SYNTAX (absent=auto)
SYNTAX is the syntax that will be used. Currently supported SYNTAX is the syntax that will be used. Currently supported
syntaxes are "pascaligo" and "cameligo". By default, the syntax is syntaxes are "pascaligo" and "cameligo". By default, the syntax is
guessed from the extension (.ligo and .mligo, respectively). |} ] ; guessed from the extension (.ligo and .mligo, respectively).
--version
Show version information. |} ] ;
run_ligo_good [ "dry-run" ; "--help" ] ; run_ligo_good [ "dry-run" ; "--help" ] ;
[%expect {| [%expect {|
@ -287,7 +302,10 @@ let%expect_test _ =
SENDER is the sender the dry-run transaction will use. SENDER is the sender the dry-run transaction will use.
--source=SOURCE --source=SOURCE
SOURCE is the source the dry-run transaction will use. |} ] ; SOURCE is the source the dry-run transaction will use.
--version
Show version information. |} ] ;
run_ligo_good [ "run-function" ; "--help" ] ; run_ligo_good [ "run-function" ; "--help" ] ;
[%expect {| [%expect {|
@ -336,7 +354,10 @@ let%expect_test _ =
SENDER is the sender the dry-run transaction will use. SENDER is the sender the dry-run transaction will use.
--source=SOURCE --source=SOURCE
SOURCE is the source the dry-run transaction will use. |} ] ; SOURCE is the source the dry-run transaction will use.
--version
Show version information. |} ] ;
run_ligo_good [ "evaluate-value" ; "--help" ] ; run_ligo_good [ "evaluate-value" ; "--help" ] ;
[%expect {| [%expect {|
@ -380,7 +401,10 @@ let%expect_test _ =
SENDER is the sender the dry-run transaction will use. SENDER is the sender the dry-run transaction will use.
--source=SOURCE --source=SOURCE
SOURCE is the source the dry-run transaction will use. |} ] ; SOURCE is the source the dry-run transaction will use.
--version
Show version information. |} ] ;
run_ligo_good [ "compile-expression" ; "--help" ] ; run_ligo_good [ "compile-expression" ; "--help" ] ;
[%expect {| [%expect {|
@ -416,4 +440,7 @@ let%expect_test _ =
--michelson-format=MICHELSON_FORMAT (absent=text) --michelson-format=MICHELSON_FORMAT (absent=text)
MICHELSON_FORMAT is the format that will be used by MICHELSON_FORMAT is the format that will be used by
compile-contract for the resulting Michelson. Available formats compile-contract for the resulting Michelson. Available formats
are 'text' (default), 'json' and 'hex'. |} ] ; are 'text' (default), 'json' and 'hex'.
--version
Show version information. |} ] ;