From e3fbc58e7ab5936e1c143e2507b3f5d1ebd85bed Mon Sep 17 00:00:00 2001 From: Tom Jack Date: Thu, 21 Nov 2019 11:43:34 -0600 Subject: [PATCH] Show help instead of "Do ligo --help" --- src/bin/cli.ml | 3 +-- src/bin/expect_tests/help_tests.ml | 43 +++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/src/bin/cli.ml b/src/bin/cli.ml index 7a9eeba5c..bd3da2499 100644 --- a/src/bin/cli.ml +++ b/src/bin/cli.ml @@ -3,8 +3,7 @@ open Trace open Cli_helpers let main = - let term = Term.(const print_endline $ const "Ligo needs a command. Do ligo --help") in - (term , Term.info "ligo") + (Term.(ret (const (`Help (`Auto, None)))) , Term.info "ligo") let source_file n = let open Arg in diff --git a/src/bin/expect_tests/help_tests.ml b/src/bin/expect_tests/help_tests.ml index c740f11ea..35a4c1ec9 100644 --- a/src/bin/expect_tests/help_tests.ml +++ b/src/bin/expect_tests/help_tests.ml @@ -3,7 +3,48 @@ open Cli_expect let%expect_test _ = (* TODO good? *) run_ligo_good [] ; - [%expect {| Ligo needs a command. Do ligo --help |} ] ; + [%expect {| + NAME + ligo + + SYNOPSIS + ligo COMMAND ... + + COMMANDS + compile-contract + Subcommand: compile a contract. See `ligo compile-contract --help' + for a list of options specific to this subcommand. + + compile-expression + Subcommand: compile to a michelson value. + + compile-parameter + Subcommand: compile parameters to a michelson expression. The + resulting michelson expression can be passed as an argument in a + transaction which calls a contract. See `ligo compile-parameter + --help' for a list of options specific to this subcommand. + + compile-storage + Subcommand: compile an initial storage in ligo syntax to a + michelson expression. The resulting michelson expression can be + passed as an argument in a transaction which originates a + contract. See `ligo compile-storage --help' for a list of options + specific to this subcommand. + + dry-run + Subcommand: run a smart-contract with the given storage and input. + + evaluate-value + Subcommand: evaluate a given definition. + + run-function + Subcommand: run a function with the given parameter. + + OPTIONS + --help[=FMT] (default=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 + `plain' whenever the TERM env var is `dumb' or undefined. |} ] ; run_ligo_good [ "--help" ] ; [%expect {|