Skip to content

Commit 3df1810

Browse files
committed
Introduce dune ocaml command group
This subgroup includes: utop, top, and merlin. Signed-off-by: Rudi Grinberg <[email protected]>
1 parent 2f525ab commit 3df1810

File tree

3 files changed

+42
-26
lines changed

3 files changed

+42
-26
lines changed

bin/import.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ module Profile = Dune_rules.Profile
2929
module Log = Dune_util.Log
3030
include Common.Let_syntax
3131

32+
let in_group (t, info) = (Term.Group.Term t, info)
33+
3234
let make_cache (config : Config.t) =
3335
let make_cache () =
3436
let command_handler (Cache.Dedup file) =

bin/main.ml

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -172,31 +172,36 @@ let command_alias cmd name =
172172
in
173173
(term, Term.info name ~docs:"COMMAND ALIASES" ~doc ~man)
174174

175-
let all =
176-
[ Installed_libraries.command
177-
; External_lib_deps.command
178-
; build_targets
179-
; runtest
180-
; command_alias runtest "test"
181-
; clean
182-
; Install_uninstall.install
183-
; Install_uninstall.uninstall
184-
; Exec.command
185-
; Subst.command
186-
; Print_rules.command
187-
; Utop.command
188-
; Init.command
189-
; promote
190-
; Printenv.command
191-
; Help.command
192-
; Format_dune_file.command
193-
; Compute.command
194-
; Upgrade.command
195-
; Caching.command
196-
; Describe.command
197-
; Top.command
198-
; Ocaml_merlin.command
199-
]
175+
let all : _ Term.Group.t list =
176+
let terms =
177+
[ Installed_libraries.command
178+
; External_lib_deps.command
179+
; build_targets
180+
; runtest
181+
; command_alias runtest "test"
182+
; clean
183+
; Install_uninstall.install
184+
; Install_uninstall.uninstall
185+
; Exec.command
186+
; Subst.command
187+
; Print_rules.command
188+
; Utop.command
189+
; Init.command
190+
; promote
191+
; Printenv.command
192+
; Help.command
193+
; Format_dune_file.command
194+
; Compute.command
195+
; Upgrade.command
196+
; Caching.command
197+
; Describe.command
198+
; Top.command
199+
; Ocaml_merlin.command
200+
]
201+
|> List.map ~f:in_group
202+
in
203+
let groups = [ Ocaml.group ] in
204+
terms @ groups
200205

201206
let common_commands_synopsis =
202207
(* Short reminders for the most used and useful commands *)
@@ -259,7 +264,7 @@ let default =
259264
let () =
260265
Colors.setup_err_formatter_colors ();
261266
try
262-
match Term.eval_choice default all ~catch:false with
267+
match Term.Group.eval default all ~catch:false with
263268
| `Error _ -> exit 1
264269
| _ -> exit 0
265270
with exn ->

doc/dune.inc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,15 @@
107107
(package dune)
108108
(files dune-installed-libraries.1))
109109

110+
(rule
111+
(with-stdout-to dune-ocaml.1
112+
(run dune ocaml --help=groff)))
113+
114+
(install
115+
(section man)
116+
(package dune)
117+
(files dune-ocaml.1))
118+
110119
(rule
111120
(with-stdout-to dune-ocaml-merlin.1
112121
(run dune ocaml-merlin --help=groff)))

0 commit comments

Comments
 (0)