@@ -42,7 +42,7 @@ let docs = "ARGUMENTS"
4242
4343let odoc_file_directories =
4444 let doc =
45- " Where to look for required .odoc files. ( Can be present several times) ."
45+ " Where to look for required $(i, .odoc) files. Can be present several times."
4646 in
4747 Arg. (
4848 value
@@ -118,7 +118,7 @@ let section_legacy = "COMMANDS: Legacy pipeline"
118118let section_deprecated = " COMMANDS: Deprecated"
119119
120120(* * Sections in the order they should appear. *)
121- let sections =
121+ let main_page_sections =
122122 [
123123 section_pipeline;
124124 section_generators;
@@ -189,48 +189,47 @@ end = struct
189189 ~warnings_options input
190190
191191 let input =
192- let doc = " Input cmti, cmt, cmi or mld file" in
192+ let doc = " Input $(i,. cmti), $(i,. cmt), $(i,. cmi) or $(i,. mld) file. " in
193193 Arg. (required & pos 0 (some file) None & info ~doc ~docv: " FILE" [] )
194194
195195 let dst =
196196 let doc =
197- " Output file path. Non-existing intermediate directories are\n \
198- \ created. If absent outputs a $(i,BASE).odoc file in \
199- the same\n \
200- \ directory as the input file where $(i,BASE) is the \
201- basename\n \
202- \ of the input file (for mld files the \" page-\" prefix \
203- will be\n \
204- \ added if not already present in the input basename)."
197+ " Output file path. Non-existing intermediate directories are created. If \
198+ absent outputs a $(i,BASE.odoc) file in the same directory as the input \
199+ file where $(i,BASE) is the basename of the input file. For mld files \
200+ the \" page-\" prefix will be added if not already present in the input \
201+ basename."
205202 in
206203 Arg. (value & opt (some string ) None & info ~docs ~docv: " PATH" ~doc [ " o" ])
207204
208205 let children =
209206 let doc =
210- " Specify the odoc file as a child. Can be used multiple times. Only \
211- applies to mld files"
207+ " Specify the $(i,. odoc) file as a child. Can be used multiple times. \
208+ Only applies to mld files"
212209 in
213210 let default = [] in
214211 Arg. (
215212 value & opt_all string default & info ~docv: " CHILD" ~doc [ " c" ; " child" ])
216213
217214 let cmd =
218215 let package_opt =
219- let doc = " Package the input is part of (deprecated - use '--parent')" in
216+ let doc =
217+ " Package the input is part of. Deprecated: use '--parent' instead."
218+ in
220219 Arg. (
221220 value
222221 & opt (some string ) None
223222 & info ~docs ~docv: " PKG" ~doc [ " package" ; " pkg" ])
224223 in
225224 let parent_opt =
226- let doc = " Parent page or subpage" in
225+ let doc = " Parent page or subpage. " in
227226 Arg. (
228227 value
229228 & opt (some string ) None
230229 & info ~docs ~docv: " PARENT" ~doc [ " parent" ])
231230 in
232231 let resolve_fwd_refs =
233- let doc = " Try resolving forward references" in
232+ let doc = " Try resolving forward references. " in
234233 Arg. (value & flag & info ~doc [ " r" ; " resolve-fwd-refs" ])
235234 in
236235 Term. (
@@ -240,8 +239,20 @@ end = struct
240239 $ warnings_options))
241240
242241 let info =
243- Term. info " compile" ~docs: section_pipeline
244- ~doc: " Compile a cmti, cmt, cmi or mld file to an odoc file."
242+ let man =
243+ [
244+ `S " DEPENDENCIES" ;
245+ `P
246+ " Dependencies between compilation units is the same as while \
247+ compiling the initial OCaml modules." ;
248+ `P " Mld pages don't have any dependency." ;
249+ ]
250+ in
251+ let doc =
252+ " Compile a $(i,.cmti), $(i,.cmt), $(i,.cmi) or $(i,.mld) file to an \
253+ $(i,.odoc) file."
254+ in
255+ Term. info " compile" ~docs: section_pipeline ~doc ~man
245256end
246257
247258module Support_files_command = struct
@@ -267,7 +278,7 @@ module Css = struct
267278
268279 let info =
269280 let doc =
270- " DEPRECATED: Use ` odoc support-files' to copy the CSS file for the \
281+ " DEPRECATED: Use $(i, odoc support-files) to copy the CSS file for the \
271282 default theme."
272283 in
273284 Term. info ~docs: section_deprecated ~doc " css"
@@ -295,24 +306,41 @@ end = struct
295306
296307 let dst =
297308 let doc =
298- " Output file path. Non-existing intermediate directories are\n \
299- \ created. If absent outputs a .odocl file in the same\n \
300- \ directory as the input file ."
309+ " Output file path. Non-existing intermediate directories are created. If \
310+ absent outputs a $(i, .odocl) file in the same directory as the input \
311+ file with the same basename ."
301312 in
302- Arg. (value & opt (some string ) None & info ~docs ~docv: " PATH" ~doc [ " o" ])
313+ Arg. (
314+ value
315+ & opt (some string ) None
316+ & info ~docs ~docv: " PATH.odocl" ~doc [ " o" ])
303317
304318 let cmd =
305319 let input =
306320 let doc = " Input file" in
307- Arg. (required & pos 0 (some file) None & info ~doc ~docv: " file .odoc" [] )
321+ Arg. (required & pos 0 (some file) None & info ~doc ~docv: " FILE .odoc" [] )
308322 in
309323 Term. (
310324 const handle_error
311325 $ (const link $ odoc_file_directories $ input $ dst $ warnings_options
312326 $ open_modules))
313327
314328 let info =
315- Term. info ~docs: section_pipeline ~doc: " Link odoc files together" " link"
329+ let man =
330+ [
331+ `S " DEPENDENCIES" ;
332+ `P
333+ " Any link step depends on the result of all the compile results that \
334+ could potentially be needed to resolve forward references. A \
335+ correct approximation is to start linking only after every compile \
336+ steps are done, passing everything that's possible to $(i,-I). Link \
337+ steps don't have dependencies between them." ;
338+ ]
339+ in
340+ let doc =
341+ " Second stage of compilation. Link a $(i,.odoc) into a $(i,.odocl)."
342+ in
343+ Term. info ~docs: section_pipeline ~doc ~man " link"
316344end
317345
318346module type S = sig
@@ -332,9 +360,13 @@ module Make_renderer (R : S) : sig
332360
333361 val generate : unit Term .t * Term .info
334362end = struct
335- let input =
336- let doc = " Input file" in
337- Arg. (required & pos 0 (some file) None & info ~doc ~docv: " file.odoc" [] )
363+ let input_odoc =
364+ let doc = " Input file." in
365+ Arg. (required & pos 0 (some file) None & info ~doc ~docv: " FILE.odoc" [] )
366+
367+ let input_odocl =
368+ let doc = " Input file." in
369+ Arg. (required & pos 0 (some file) None & info ~doc ~docv: " FILE.odocl" [] )
338370
339371 module Process = struct
340372 let process extra _hidden directories output_dir syntax input_file
@@ -358,11 +390,14 @@ end = struct
358390 Term. (
359391 const handle_error
360392 $ (const process $ R. extra_args $ hidden $ odoc_file_directories
361- $ dst ~create: true () $ syntax $ input $ warnings_options))
393+ $ dst ~create: true () $ syntax $ input_odoc $ warnings_options))
362394
363395 let info =
364396 let doc =
365- Format. sprintf " Render %s files from an odoc one" R. renderer.name
397+ Format. sprintf
398+ " Render %s files from a $(i,.odoc). $(i,link) then $(i,%s-generate) \
399+ should be used instead."
400+ R. renderer.name R. renderer.name
366401 in
367402 Term. info ~docs: section_legacy ~doc R. renderer.name
368403 end
@@ -388,11 +423,11 @@ end = struct
388423 Term. (
389424 const handle_error
390425 $ (const generate $ R. extra_args $ hidden $ dst ~create: true () $ syntax
391- $ extra_suffix $ input ))
426+ $ extra_suffix $ input_odocl ))
392427
393428 let info =
394429 let doc =
395- Format. sprintf " Generate %s files from an odocl one " R. renderer.name
430+ Format. sprintf " Generate %s files from a $(i,. odocl). " R. renderer.name
396431 in
397432 Term. info ~docs: R. generate_docs ~doc (R. renderer.name ^ " -generate" )
398433 end
@@ -413,8 +448,8 @@ end = struct
413448
414449 let back_compat =
415450 let doc =
416- " For backwards compatibility when processing odoc rather than odocl \
417- files."
451+ " For backwards compatibility when processing $(i,. odoc) rather than \
452+ $(i,.odocl) files."
418453 in
419454 Arg. (
420455 value
@@ -424,12 +459,17 @@ end = struct
424459 let cmd =
425460 Term. (
426461 const handle_error
427- $ (const list_targets $ dst () $ back_compat $ R. extra_args $ input))
462+ $ (const list_targets $ dst () $ back_compat $ R. extra_args
463+ $ input_odocl))
428464
429465 let info =
430- Term. info
431- (R. renderer.name ^ " -targets" )
432- ~docs: section_support ~doc: " TODO: Fill in."
466+ let doc =
467+ Format. sprintf
468+ " Print the files that would be generated by $(i,%s-generate). Works \
469+ on both $(i,.odoc) and $(i,.odocl) files."
470+ R. renderer.name
471+ in
472+ Term. info (R. renderer.name ^ " -targets" ) ~docs: section_support ~doc
433473 end
434474
435475 let targets = Targets. (cmd, info)
@@ -453,7 +493,7 @@ end = struct
453493
454494 let info =
455495 Term. info ~docs: section_support
456- ~doc: " Resolve a reference and output its corresponding url" " latex-url"
496+ ~doc: " Resolve a reference and output its corresponding url. " " latex-url"
457497end
458498
459499module Odoc_html_args = struct
@@ -462,7 +502,7 @@ module Odoc_html_args = struct
462502 let renderer = Html_page. renderer
463503
464504 let semantic_uris =
465- let doc = " Generate pretty (semantic) links" in
505+ let doc = " Generate pretty (semantic) links. " in
466506 Arg. (value & flag (info ~doc [ " semantic-uris" ; " pretty-uris" ]))
467507
468508 let closed_details =
@@ -473,7 +513,7 @@ module Odoc_html_args = struct
473513 Arg. (value & flag (info ~doc [ " closed-details" ]))
474514
475515 let indent =
476- let doc = " Format the output HTML files with indentation" in
516+ let doc = " Format the output HTML files with indentation. " in
477517 Arg. (value & flag (info ~doc [ " indent" ]))
478518
479519 (* Very basic validation and normalization for URI paths. *)
@@ -588,7 +628,7 @@ end = struct
588628
589629 let info =
590630 Term. info ~docs: section_support
591- ~doc: " Resolve a reference and output its corresponding url" " html-url"
631+ ~doc: " Resolve a reference and output its corresponding url. " " html-url"
592632end
593633
594634module Html_fragment : sig
@@ -614,13 +654,13 @@ end = struct
614654
615655 let cmd =
616656 let output =
617- let doc = " Output HTML fragment file" in
657+ let doc = " Output HTML fragment file. " in
618658 Arg. (
619659 value & opt string " /dev/stdout"
620660 & info ~docs ~docv: " file.html" ~doc [ " o" ; " output-file" ])
621661 in
622662 let input =
623- let doc = " Input documentation page file" in
663+ let doc = " Input documentation page file. " in
624664 Arg. (required & pos 0 (some file) None & info ~doc ~docv: " file.mld" [] )
625665 in
626666 let xref_base_uri =
@@ -637,7 +677,7 @@ end = struct
637677
638678 let info =
639679 Term. info ~docs: section_legacy
640- ~doc: " Generates an html fragment file from an mld one" " html-fragment"
680+ ~doc: " Generates an html fragment file from an mld one. " " html-fragment"
641681end
642682
643683module Odoc_manpage = Make_renderer (struct
@@ -656,7 +696,7 @@ module Odoc_latex = Make_renderer (struct
656696 let renderer = Latex. renderer
657697
658698 let with_children =
659- let doc = " Include children at the end of the page" in
699+ let doc = " Include children at the end of the page. " in
660700 Arg. (value & opt bool true & info ~docv: " BOOL" ~doc [ " with-children" ])
661701
662702 let extra_args =
@@ -692,7 +732,9 @@ module Depends = struct
692732 ~doc:
693733 " List units (with their digest) which needs to be compiled in order \
694734 to compile this one. The unit itself and its digest is also \
695- reported in the output."
735+ reported in the output.\n \
736+ Dependencies between compile steps are the same as when compiling \
737+ the ocaml modules."
696738 end
697739
698740 module Link = struct
@@ -736,8 +778,12 @@ module Depends = struct
736778 let info =
737779 Term. info " link-deps" ~docs: section_legacy
738780 ~doc:
739- " lists the packages which need to be in odoc's load path to link the \
740- .odoc files in the given directory"
781+ " Lists the packages which need to be in odoc's load path to link the \
782+ $(i,.odoc) files in the given directory.\n \
783+ The result is not correct in case of forward references. A \
784+ conservative approximation is: any link step depends on the result \
785+ of all the compile steps that could be targeted by a forward \
786+ reference."
741787 end
742788
743789 module Odoc_html = struct
@@ -773,7 +819,10 @@ module Targets = struct
773819 let cmd = Term. (const list_targets $ Compile. dst $ Compile. input)
774820
775821 let info =
776- Term. info " compile-targets" ~docs: section_legacy ~doc: " TODO: Fill in."
822+ Term. info " compile-targets" ~docs: section_legacy
823+ ~doc:
824+ " Print the name of the file produced by $(i,compile). If $(i,-o) is \
825+ passed, the same path is printed but error checking is performed."
777826 end
778827
779828 module Support_files = struct
@@ -785,7 +834,8 @@ module Targets = struct
785834
786835 let info =
787836 Term. info " support-files-targets" ~docs: section_support
788- ~doc: " Lists the names of the files that 'odoc support-files' outputs."
837+ ~doc:
838+ " Lists the names of the files that $(i,odoc support-files) outputs."
789839 end
790840end
791841
@@ -799,14 +849,14 @@ module Odoc_error = struct
799849 Ok ()
800850
801851 let input =
802- let doc = " Input odoc or odocl file" in
852+ let doc = " Input $(i,. odoc) or $(i,. odocl) file" in
803853 Arg. (required & pos 0 (some file) None & info ~doc ~docv: " FILE" [] )
804854
805855 let cmd = Term. (const handle_error $ (const errors $ input))
806856
807857 let info =
808858 Term. info " errors" ~docs: section_support
809- ~doc: " Print errors that occurred while an .odoc file was generated ."
859+ ~doc: " Print errors that occurred while compiling or linking ."
810860end
811861
812862let () =
@@ -848,7 +898,7 @@ let () =
848898 in
849899 let man =
850900 (* Show sections in a defined order. *)
851- List. map ~f: (fun s -> `S s) sections
901+ List. map ~f: (fun s -> `S s) main_page_sections
852902 in
853903 ( Term. (const print_default $ const () ),
854904 Term. info ~man ~version: " %%VERSION%%" " odoc" )
0 commit comments