Tool man pages

See also the section about man pages in the command line interface manual.

Man page generation

Man page sections for a command are printed in the order specified by the man value given to Cmdliner.Cmd.info. Unless specified explicitly in the man value the following sections are automatically created and populated for you:

The various doc documentation strings specified by the command's term arguments get inserted at the end of the documentation section they respectively mention in their docs argument:

  1. For commands, see Cmdliner.Cmd.info.
  2. For positional arguments, see Cmdliner.Arg.info. Those are listed iff both the docv and doc string is specified by Cmdliner.Arg.info.
  3. For optional arguments, see Cmdliner.Arg.info.
  4. For exit statuses, see Cmdliner.Cmd.Exit.info.
  5. For environment variables, see Cmdliner.Cmd.Env.info.

If a docs section name is mentioned and does not exist in the command's man value, an empty section is created for it, after which the doc strings are inserted, possibly prefixed by boilerplate text (e.g. for Cmdliner.Manpage.s_environment and Cmdliner.Manpage.s_exit_status).

If the created section is:

Finally note that the header of empty sections are dropped from the output. This allows you to share section placements among many commands and render them only if something actually gets inserted in it.

Documentation markup language

Manpage blocks and the doc strings of the various info values support the following markup language.