Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
EmileTrotignon committed Sep 27, 2023
1 parent 7bcfcb2 commit 52bf343
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion bin/build_cmd.ml
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,4 @@ let fmt =
run_build_command ~common ~config ~request
in
Cmd.v (Cmd.info "fmt" ~doc ~man ~envs:Common.envs) term
;;
;;
4 changes: 2 additions & 2 deletions bin/build_cmd.mli
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ val runtest_term : unit Term.t
val build : unit Cmd.t
val fmt : unit Cmd.t

val run_build_command :
common:Common.t
val run_build_command
: common:Common.t
-> config:Dune_config.t
-> request:(Dune_rules.Main.build_system -> unit Action_builder.t)
-> unit
22 changes: 9 additions & 13 deletions bin/ocaml/doc.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
open Stdune
open Import

let doc = "Build and view the documentation of an OCaml project"
Expand All @@ -9,6 +8,7 @@ let man =
{|$(b,dune ocaml doc) builds and then opens the documention of an OCaml project in the users default browser.|}
; `Blocks Common.help_secs
]
;;

let info = Cmd.info "doc" ~doc ~man

Expand All @@ -21,22 +21,20 @@ let term =
let+ () =
Alias.in_dir
~name:(Dune_engine.Alias.Name.of_string "doc")
~recursive:true ~contexts:setup.contexts dir
~recursive:true
~contexts:setup.contexts
dir
|> Alias.request
in
let is_default ctx =
ctx |> Context.name |> Dune_engine.Context_name.is_default
in
let is_default ctx = ctx |> Context.name |> Dune_engine.Context_name.is_default in
let doc_ctx = List.find_exn setup.contexts ~f:is_default in
let toplevel_index_path = Dune_rules.Odoc.Paths.toplevel_index doc_ctx in
let absolute_toplevel_index_path =
Path.(toplevel_index_path |> build |> to_absolute_filename)
in
Dune_console.print
[ Pp.textf "Docs built. Index can be found here: %s\n"
absolute_toplevel_index_path
[ Pp.textf "Docs built. Index can be found here: %s\n" absolute_toplevel_index_path
];

let url = "file://" ^ absolute_toplevel_index_path in
let cmd =
let open Option.O in
Expand All @@ -55,16 +53,14 @@ let term =
in
match cmd with
| Some (cmd, args) ->
Proc.restore_cwd_and_execve
(Path.to_absolute_filename cmd)
args ~env:Env.initial
Proc.restore_cwd_and_execve (Path.to_absolute_filename cmd) args ~env:Env.initial
| None ->
User_warning.emit
[ Pp.text
"No browser could be found, you will have to open the \
documentation yourself."
"No browser could be found, you will have to open the documentation yourself."
]
in
Build_cmd.run_build_command ~common ~config ~request
;;

let cmd = Cmd.v info term
1 change: 0 additions & 1 deletion src/dune_rules/odoc.mli
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module Paths : sig
end

val setup_library_odoc_rules : Compilation_context.t -> Lib.Local.t -> unit Memo.t

val gen_project_rules : Super_context.t -> Dune_project.t -> unit Memo.t

val setup_private_library_doc_alias
Expand Down

0 comments on commit 52bf343

Please sign in to comment.