Module Cmdliner.Manpage
Man page specification.
Man page generation is automatically handled by Cmdliner, consult the details.
The block type is used to define a man page's content. It's a good idea to follow the standard manual page structure.
References.
man-pages(7), Conventions for writing Linux man pages.
Man pages
type block=[|`S of string|`P of string|`Pre of string|`I of string * string|`Noblank|`Blocks of block list]The type for a block of man page text.
`S sintroduces a new sections, see the standard section names.`P tis a new paragraph with textt.`Pre tis a new preformatted paragraph with textt.`I (l,t)is an indented paragraph with labelland textt.`Noblanksuppresses the blank line introduced between two blocks.`Blocks bssplices the blocksbs.
Except in
`Pre, whitespace and newlines are not significant and are all collapsed to a single space. All block strings support the documentation markup language.
val escape : string -> stringescape sescapessso that it doesn't get interpreted by the documentation markup language.
type title= string * int * string * string * stringThe type for man page titles. Describes the man page
title,section,center_footer,left_footer,center_header.
type xref=[|`Main|`Cmd of string|`Tool of string|`Page of string * int]The type for man page cross-references.
`Mainrefers to the man page of the program itself.`Cmd cmdrefers to the man page of the program'scmdcommand (which must exist).`Tool binrefers to the command line tool namedbin.`Page (name, sec)refers to the man pagename(sec).
Standard section names and content
The following are standard man page section names, roughly ordered in the order they conventionally appear. See also man man-pages for more elaborations about what sections should contain.
val s_synopsis : stringThe
SYNOPSISsection. By default this section is automatically created byCmdlinerfor you, unless it is the first section of your term's man page, in which case it will replace it with yours.
val s_description : stringThe
DESCRIPTIONsection. This should be a description of what the tool does and provide a little bit of usage and documentation guidance.
val s_common_options : stringThe
COMMON OPTIONSsection. For programs with multiple commands a section that can be used to gather options common to all commands.
val s_exit_status : stringThe
EXIT STATUSsection. By default term status exit codes get listed here.
val s_environment : stringThe
ENVIRONMENTsection. By default environment variables get listed here.
val s_environment_intro : blocks_environment_introis the introduction content used by cmdliner when it creates thes_environmentsection.
Output
The print function can be useful if the client wants to define other man pages (e.g. to implement a help command).
type format=[|`Auto|`Pager|`Plain|`Groff]The type for man page output specification.
`Auto, formats like`Pageror`Plainwhenever theTERMenvironment variable isdumbor unset.`Pager, tries to write to a discovered pager, if that fails uses the`Plainformat.`Plain, formats to plain text.`Groff, formats to groff commands.
val print : ?errs:Stdlib.Format.formatter -> ?subst:(string -> string option) -> format -> Stdlib.Format.formatter -> t -> unitprint ~errs ~subst fmt ppf pageprintspageonppfin the formatfmt.substcan be used to perform variable substitution,(defaults to the identity).errsis used to print formatting errors, it defaults toFormat.err_formatter.