Next: , Up: Automated Man Pages   [Contents][Index]


7.14.1 command line man pages

Man pages for commands are documented using the agman-cmd.tpl and agmdoc-cmd.tpl templates. If the options specify pulling information from RC/ini/cfg files, then you may use the rc-sample.tpl template to produce an example config file for your program.

Using the option definitions for an AutoOpts client program, the ‘agman-cmd.tpl’ template will produce an nroff document suitable for use as a ‘man(1)’ page document for a command line command. The description section of the document is either the ‘prog-man-descrip’ text, if present, or the ‘detail’ text.

Each option in the option definitions file is fully documented in its usage. This includes all the information documented above for each option (see Option Attributes), plus the ‘doc’ attribute is appended. Since the ‘doc’ text is presumed to be designed for texinfo documentation, sed is used to convert some constructs from texi to nroff-for-man-pages. Specifically,

convert @code, @var and @samp into \fB...\fP phrases
convert @file into \fI...\fP phrases
Remove the '@' prefix from curly braces
Indent example regions
Delete the example commands
Replace ‘end example’ command with ".br"
Replace the ‘@*’ command with ".br"

This document is produced by invoking the following command:

autogen -L ${prefix}/share/autogen -Tagman-cmd.tpl options.def

Where ${prefix} is the AutoGen installation prefix and options.def is the name of your product’s option definition file. I do not use this very much, so any feedback or improvements would be greatly appreciated.