From dd77e045e668afd78580aa47b5e877e818cdb21c Mon Sep 17 00:00:00 2001 From: Jeremie Dimino Date: Fri, 24 Feb 2017 15:47:09 +0000 Subject: [PATCH] Set the default command to printing some help --- README.org | 2 +- bin/main.ml | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.org b/README.org index 350d189e..f924786e 100644 --- a/README.org +++ b/README.org @@ -64,7 +64,7 @@ you can do right now is write some jbuild files, and invoke jbuilder at the root of your project as follows: #+begin_src -$ jbuilder .install +$ jbuilder build .install #+end_src Building the =.install= file will build all the things that need to be diff --git a/bin/main.ml b/bin/main.ml index dfd1ea09..d81c9ec4 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -187,7 +187,7 @@ let resolve_targets (setup : Main.setup) user_targets = | File path -> path | Alias (_, alias) -> Alias.file alias) -let build_targets ~name = +let build_targets = let doc = "build targets" in let name_ = Arg.info [] ~docv:"TARGET" in let go common targets = @@ -199,7 +199,7 @@ let build_targets ~name = ( Term.(const go $ common $ Arg.(non_empty & pos_all string [] name_)) - , Term.info name ~doc ~man:help_secs) + , Term.info "build" ~doc ~man:help_secs) let runtest = let doc = "run tests" in @@ -287,16 +287,21 @@ let all = [ internal ; build_package ; external_lib_deps - ; build_targets ~name:"build" + ; build_targets ; runtest ; install ; uninstall ] +let default = + let doc = "fast, portable and opinionated build system for OCaml" in + ( Term.(ret @@ const @@ `Help (`Pager, None)) + , Term.info "jbuilder" ~doc) + let () = Ansi_color.setup_err_formatter_colors (); try - match Term.eval_choice (build_targets ~name:"jbuilder") all ~catch:false with + match Term.eval_choice default all ~catch:false with | `Error _ -> exit 1 | _ -> exit 0 with exn ->