diff --git a/bin/import.ml b/bin/import.ml index 3680e49f129b..a1dab2955201 100644 --- a/bin/import.ml +++ b/bin/import.ml @@ -29,6 +29,8 @@ module Profile = Dune_rules.Profile module Log = Dune_util.Log include Common.Let_syntax +let in_group (t, info) = (Term.Group.Term t, info) + let make_cache (config : Config.t) = let make_cache () = let command_handler (Cache.Dedup file) = diff --git a/bin/main.ml b/bin/main.ml index 68159d2f1022..8a77a4dcbc3e 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -172,31 +172,36 @@ let command_alias cmd name = in (term, Term.info name ~docs:"COMMAND ALIASES" ~doc ~man) -let all = - [ Installed_libraries.command - ; External_lib_deps.command - ; build_targets - ; runtest - ; command_alias runtest "test" - ; clean - ; Install_uninstall.install - ; Install_uninstall.uninstall - ; Exec.command - ; Subst.command - ; Print_rules.command - ; Utop.command - ; Init.command - ; promote - ; Printenv.command - ; Help.command - ; Format_dune_file.command - ; Compute.command - ; Upgrade.command - ; Caching.command - ; Describe.command - ; Top.command - ; Ocaml_merlin.command - ] +let all : _ Term.Group.t list = + let terms = + [ Installed_libraries.command + ; External_lib_deps.command + ; build_targets + ; runtest + ; command_alias runtest "test" + ; clean + ; Install_uninstall.install + ; Install_uninstall.uninstall + ; Exec.command + ; Subst.command + ; Print_rules.command + ; Utop.command + ; Init.command + ; promote + ; Printenv.command + ; Help.command + ; Format_dune_file.command + ; Compute.command + ; Upgrade.command + ; Caching.command + ; Describe.command + ; Top.command + ; Ocaml_merlin.command + ] + |> List.map ~f:in_group + in + let groups = [ Ocaml.group ] in + terms @ groups let common_commands_synopsis = (* Short reminders for the most used and useful commands *) @@ -259,7 +264,7 @@ let default = let () = Colors.setup_err_formatter_colors (); try - match Term.eval_choice default all ~catch:false with + match Term.Group.eval default all ~catch:false with | `Error _ -> exit 1 | _ -> exit 0 with exn -> diff --git a/bin/ocaml.ml b/bin/ocaml.ml new file mode 100644 index 000000000000..0605784e0e6a --- /dev/null +++ b/bin/ocaml.ml @@ -0,0 +1,11 @@ +open Import + +let info = Term.info "ocaml" + +let group = + ( Term.Group.Group + [ in_group Utop.command + ; in_group Ocaml_merlin.command + ; in_group Top.command + ] + , info ) diff --git a/bin/ocaml.mli b/bin/ocaml.mli new file mode 100644 index 000000000000..8c539d3387e8 --- /dev/null +++ b/bin/ocaml.mli @@ -0,0 +1,3 @@ +open Import + +val group : unit Term.Group.t diff --git a/doc/dune.inc b/doc/dune.inc index a8e006ff0ddc..f49d19c58cdd 100644 --- a/doc/dune.inc +++ b/doc/dune.inc @@ -107,6 +107,15 @@ (package dune) (files dune-installed-libraries.1)) +(rule + (with-stdout-to dune-ocaml.1 + (run dune ocaml --help=groff))) + +(install + (section man) + (package dune) + (files dune-ocaml.1)) + (rule (with-stdout-to dune-ocaml-merlin.1 (run dune ocaml-merlin --help=groff)))