module Manpage:sig
..end
Man page generation is automatically handled by Cmdliner
. The
Cmdliner.Manpage.block
type is used to define a man page's content.
The Cmdliner.Manpage.print
function can be useful if the client wants to define
other man pages (e.g. to implement a help command).
typeblock =
[ `I of string * string | `Noblank | `P of string | `S of string ]
`S s
introduces a new section s
.`P t
is a new paragraph with text t
.`I (l,t)
is an indented paragraph with label
l
and text t
.`Noblank
suppresses the blank line introduced between two blocks.
In text strings t
, whitespace and newlines are not significant
and are all collapsed to a single space. In labels l
and text
strings t
, the syntax "$(i,italic text)"
and "$(b,bold
text)"
can be used to respectively produce italic and bold
text.
typetitle =
string * int * string * string * string
title
, section
, center_footer
, left_footer
, center_header
.typet =
title * block list
val print : ?subst:(string -> string) ->
[ `Groff | `Pager | `Plain ] ->
Format.formatter -> t -> unit
print ~subst fmt ppf page
prints page
on ppf
in the format fmt
.
If fmt
is `Pager
the function tries to write the formatted
result in a pager, if that fails the format `Plain
is written
on ppf
. subst
can be used to perform variable substitution,
see Buffer.add_substitute
(defaults to the identity).