Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bin/tools/tools.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ module Exec = struct
let group =
Cmd.group
info
(List.map [ Ocamlformat; Ocamllsp; Ocamlearlybird ] ~f:Tools_common.exec_command)
(List.map
[ Ocamlformat; Ocamllsp; Ocamlearlybird; Odig ]
~f:Tools_common.exec_command)
;;
end

Expand Down
12 changes: 11 additions & 1 deletion src/dune_pkg/dev_tool.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ type t =
| Ocamllsp
| Utop
| Ocamlearlybird
| Odig

let to_dyn = function
| Ocamlformat -> Dyn.variant "Ocamlformat" []
| Odoc -> Dyn.variant "Odoc" []
| Ocamllsp -> Dyn.variant "Ocamllsp" []
| Utop -> Dyn.variant "Utop" []
| Ocamlearlybird -> Dyn.variant "Ocamlearlybird" []
| Odig -> Dyn.variant "Odig" []
;;

let all = [ Ocamlformat; Odoc; Ocamllsp; Utop; Ocamlearlybird ]
let all = [ Ocamlformat; Odoc; Ocamllsp; Utop; Ocamlearlybird; Odig ]

let equal a b =
match a, b with
Expand All @@ -28,6 +30,9 @@ let equal a b =
| Utop, Utop -> true
| Utop, _ | _, Utop -> false
| Ocamlearlybird, Ocamlearlybird -> true
| Ocamlearlybird, _ -> false
| _, Ocamlearlybird -> true
| Odig, Odig -> true
;;

let package_name = function
Expand All @@ -36,6 +41,7 @@ let package_name = function
| Ocamllsp -> Package_name.of_string "ocaml-lsp-server"
| Utop -> Package_name.of_string "utop"
| Ocamlearlybird -> Package_name.of_string "earlybird"
| Odig -> Package_name.of_string "odig"
;;

let of_package_name package_name =
Expand All @@ -45,6 +51,7 @@ let of_package_name package_name =
| "ocaml-lsp-server" -> Ocamllsp
| "utop" -> Utop
| "earlybird" -> Ocamlearlybird
| "odig" -> Odig
| other -> User_error.raise [ Pp.textf "No such dev tool: %s" other ]
;;

Expand All @@ -54,6 +61,7 @@ let exe_name = function
| Ocamllsp -> "ocamllsp"
| Utop -> "utop"
| Ocamlearlybird -> "ocamlearlybird"
| Odig -> "odig"
;;

let exe_path_components_within_package t =
Expand All @@ -63,6 +71,7 @@ let exe_path_components_within_package t =
| Ocamllsp -> [ "bin"; exe_name t ]
| Utop -> [ "bin"; exe_name t ]
| Ocamlearlybird -> [ "bin"; exe_name t ]
| Odig -> [ "bin"; exe_name t ]
;;

let needs_to_build_with_same_compiler_as_project = function
Expand All @@ -71,4 +80,5 @@ let needs_to_build_with_same_compiler_as_project = function
| Ocamllsp -> true
| Utop -> false
| Ocamlearlybird -> false
| Odig -> false
;;
1 change: 1 addition & 0 deletions src/dune_pkg/dev_tool.mli
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ type t =
| Ocamllsp
| Utop
| Ocamlearlybird
| Odig

val to_dyn : t -> Dyn.t
val all : t list
Expand Down
6 changes: 6 additions & 0 deletions test/blackbox-tests/test-cases/pkg/dev-tools-help-message.t
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ Output the help text:
ocamllsp executable (pass flags to ocamllsp after the '--'
argument, such as 'dune tools exec ocamllsp -- --help').

odig [OPTION]… [ARGS]…
Wrapper for running odig intended to be run automatically by a
text editor. All positional arguments will be passed to the odig
executable (pass flags to odig after the '--' argument, such as
'dune tools exec odig -- --help').

COMMON OPTIONS
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of auto,
Expand Down
Loading