this repo has no description
1open Bos
2open Cmd_outputs
3
4let sherlodoc = Cmd.v "sherlodoc"
5
6(* All paths relative to the html output dir *)
7
8(* Per-package sherlodoc db for javascript search*)
9let db_js_file pkg_dir = Fpath.(pkg_dir / "sherlodoc_db.js")
10
11(* Global sherlodoc marshal file for server-side global search *)
12let db_marshal_file = Fpath.v "sherlodoc_db.marshal"
13
14(* Global static sherlodoc support file for javascript search *)
15let js_file = Fpath.v "sherlodoc.js"
16
17let index ?(ignore_output = false) ~format ~inputs ~dst ?favored_prefixes () =
18 let desc = Printf.sprintf "Sherlodoc indexing at %s" (Fpath.to_string dst) in
19 let format =
20 Cmd.(v "--format" % match format with `marshal -> "marshal" | `js -> "js")
21 in
22 let favored_prefixes =
23 match favored_prefixes with
24 | None -> Cmd.empty
25 | Some favored_prefixes ->
26 Cmd.(v "--favoured_prefixes" % String.concat "," favored_prefixes)
27 in
28 let inputs = Cmd.(inputs |> List.map p |> of_list) in
29 let cmd =
30 Cmd.(
31 sherlodoc % "index" %% format %% favored_prefixes %% inputs % "-o" % p dst)
32 in
33 let log =
34 if ignore_output then None else Some (`Sherlodoc, Fpath.to_string dst)
35 in
36 ignore @@ submit_ignore_failures log desc cmd (Some dst)
37
38let js dst =
39 let cmd = Cmd.(sherlodoc % "js" % p dst) in
40 let desc = Printf.sprintf "Sherlodoc js at %s" (Fpath.to_string dst) in
41 let _lines =
42 submit_ignore_failures
43 (Some (`Sherlodoc, Fpath.to_string dst))
44 desc cmd (Some dst)
45 in
46 ()