@@ -42,7 +42,7 @@ let docs = "ARGUMENTS"
42
42
43
43
let odoc_file_directories =
44
44
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."
46
46
in
47
47
Arg. (
48
48
value
@@ -118,7 +118,7 @@ let section_legacy = "COMMANDS: Legacy pipeline"
118
118
let section_deprecated = " COMMANDS: Deprecated"
119
119
120
120
(* * Sections in the order they should appear. *)
121
- let sections =
121
+ let main_page_sections =
122
122
[
123
123
section_pipeline;
124
124
section_generators;
@@ -189,48 +189,47 @@ end = struct
189
189
~warnings_options input
190
190
191
191
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
193
193
Arg. (required & pos 0 (some file) None & info ~doc ~docv: " FILE" [] )
194
194
195
195
let dst =
196
196
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."
205
202
in
206
203
Arg. (value & opt (some string ) None & info ~docs ~docv: " PATH" ~doc [ " o" ])
207
204
208
205
let children =
209
206
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"
212
209
in
213
210
let default = [] in
214
211
Arg. (
215
212
value & opt_all string default & info ~docv: " CHILD" ~doc [ " c" ; " child" ])
216
213
217
214
let cmd =
218
215
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
220
219
Arg. (
221
220
value
222
221
& opt (some string ) None
223
222
& info ~docs ~docv: " PKG" ~doc [ " package" ; " pkg" ])
224
223
in
225
224
let parent_opt =
226
- let doc = " Parent page or subpage" in
225
+ let doc = " Parent page or subpage. " in
227
226
Arg. (
228
227
value
229
228
& opt (some string ) None
230
229
& info ~docs ~docv: " PARENT" ~doc [ " parent" ])
231
230
in
232
231
let resolve_fwd_refs =
233
- let doc = " Try resolving forward references" in
232
+ let doc = " Try resolving forward references. " in
234
233
Arg. (value & flag & info ~doc [ " r" ; " resolve-fwd-refs" ])
235
234
in
236
235
Term. (
@@ -240,8 +239,20 @@ end = struct
240
239
$ warnings_options))
241
240
242
241
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
245
256
end
246
257
247
258
module Support_files_command = struct
@@ -267,7 +278,7 @@ module Css = struct
267
278
268
279
let info =
269
280
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 \
271
282
default theme."
272
283
in
273
284
Term. info ~docs: section_deprecated ~doc " css"
@@ -295,24 +306,41 @@ end = struct
295
306
296
307
let dst =
297
308
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 ."
301
312
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" ])
303
317
304
318
let cmd =
305
319
let input =
306
320
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" [] )
308
322
in
309
323
Term. (
310
324
const handle_error
311
325
$ (const link $ odoc_file_directories $ input $ dst $ warnings_options
312
326
$ open_modules))
313
327
314
328
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"
316
344
end
317
345
318
346
module type S = sig
@@ -332,9 +360,13 @@ module Make_renderer (R : S) : sig
332
360
333
361
val generate : unit Term .t * Term .info
334
362
end = 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" [] )
338
370
339
371
module Process = struct
340
372
let process extra _hidden directories output_dir syntax input_file
@@ -358,11 +390,14 @@ end = struct
358
390
Term. (
359
391
const handle_error
360
392
$ (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))
362
394
363
395
let info =
364
396
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
366
401
in
367
402
Term. info ~docs: section_legacy ~doc R. renderer.name
368
403
end
@@ -388,11 +423,11 @@ end = struct
388
423
Term. (
389
424
const handle_error
390
425
$ (const generate $ R. extra_args $ hidden $ dst ~create: true () $ syntax
391
- $ extra_suffix $ input ))
426
+ $ extra_suffix $ input_odocl ))
392
427
393
428
let info =
394
429
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
396
431
in
397
432
Term. info ~docs: R. generate_docs ~doc (R. renderer.name ^ " -generate" )
398
433
end
@@ -413,8 +448,8 @@ end = struct
413
448
414
449
let back_compat =
415
450
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."
418
453
in
419
454
Arg. (
420
455
value
@@ -424,12 +459,17 @@ end = struct
424
459
let cmd =
425
460
Term. (
426
461
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))
428
464
429
465
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
433
473
end
434
474
435
475
let targets = Targets. (cmd, info)
@@ -453,7 +493,7 @@ end = struct
453
493
454
494
let info =
455
495
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"
457
497
end
458
498
459
499
module Odoc_html_args = struct
@@ -462,7 +502,7 @@ module Odoc_html_args = struct
462
502
let renderer = Html_page. renderer
463
503
464
504
let semantic_uris =
465
- let doc = " Generate pretty (semantic) links" in
505
+ let doc = " Generate pretty (semantic) links. " in
466
506
Arg. (value & flag (info ~doc [ " semantic-uris" ; " pretty-uris" ]))
467
507
468
508
let closed_details =
@@ -473,7 +513,7 @@ module Odoc_html_args = struct
473
513
Arg. (value & flag (info ~doc [ " closed-details" ]))
474
514
475
515
let indent =
476
- let doc = " Format the output HTML files with indentation" in
516
+ let doc = " Format the output HTML files with indentation. " in
477
517
Arg. (value & flag (info ~doc [ " indent" ]))
478
518
479
519
(* Very basic validation and normalization for URI paths. *)
@@ -588,7 +628,7 @@ end = struct
588
628
589
629
let info =
590
630
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"
592
632
end
593
633
594
634
module Html_fragment : sig
@@ -614,13 +654,13 @@ end = struct
614
654
615
655
let cmd =
616
656
let output =
617
- let doc = " Output HTML fragment file" in
657
+ let doc = " Output HTML fragment file. " in
618
658
Arg. (
619
659
value & opt string " /dev/stdout"
620
660
& info ~docs ~docv: " file.html" ~doc [ " o" ; " output-file" ])
621
661
in
622
662
let input =
623
- let doc = " Input documentation page file" in
663
+ let doc = " Input documentation page file. " in
624
664
Arg. (required & pos 0 (some file) None & info ~doc ~docv: " file.mld" [] )
625
665
in
626
666
let xref_base_uri =
@@ -637,7 +677,7 @@ end = struct
637
677
638
678
let info =
639
679
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"
641
681
end
642
682
643
683
module Odoc_manpage = Make_renderer (struct
@@ -656,7 +696,7 @@ module Odoc_latex = Make_renderer (struct
656
696
let renderer = Latex. renderer
657
697
658
698
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
660
700
Arg. (value & opt bool true & info ~docv: " BOOL" ~doc [ " with-children" ])
661
701
662
702
let extra_args =
@@ -692,7 +732,9 @@ module Depends = struct
692
732
~doc:
693
733
" List units (with their digest) which needs to be compiled in order \
694
734
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."
696
738
end
697
739
698
740
module Link = struct
@@ -736,8 +778,12 @@ module Depends = struct
736
778
let info =
737
779
Term. info " link-deps" ~docs: section_legacy
738
780
~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."
741
787
end
742
788
743
789
module Odoc_html = struct
@@ -773,7 +819,10 @@ module Targets = struct
773
819
let cmd = Term. (const list_targets $ Compile. dst $ Compile. input)
774
820
775
821
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."
777
826
end
778
827
779
828
module Support_files = struct
@@ -785,7 +834,8 @@ module Targets = struct
785
834
786
835
let info =
787
836
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."
789
839
end
790
840
end
791
841
@@ -799,14 +849,14 @@ module Odoc_error = struct
799
849
Ok ()
800
850
801
851
let input =
802
- let doc = " Input odoc or odocl file" in
852
+ let doc = " Input $(i,. odoc) or $(i,. odocl) file" in
803
853
Arg. (required & pos 0 (some file) None & info ~doc ~docv: " FILE" [] )
804
854
805
855
let cmd = Term. (const handle_error $ (const errors $ input))
806
856
807
857
let info =
808
858
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 ."
810
860
end
811
861
812
862
let () =
@@ -848,7 +898,7 @@ let () =
848
898
in
849
899
let man =
850
900
(* 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
852
902
in
853
903
( Term. (const print_default $ const () ),
854
904
Term. info ~man ~version: " %%VERSION%%" " odoc" )
0 commit comments