Many projects suffer from poor, missing, or out-of-date man pages. These tend to get out-of-sync with the main release, especially because they are tricky to write (the GROFF language isn't exactly familiar to most programmers, even with the asssistance of utilities such as manedit.
I think the most natural place for documentation is inside the program itself (invocation with "-h"), because it keeps the documentation and code together - this makes it much
easier to keep them in sync, and to ensure the documentation is written at all. Furthermore, it allows the documentation to be more accurate: the output of "-h" can include information
known to the program, such as #defined constants from the header file, or specific build-time details; these can't usually be dynamically inserted into man pages.
It does makethe binaries slightly bigger, but usually this isn't a problem.
Thus, help_to_man, a system designed for the maximum simplicity of integration and ease of use. It takes only a couple of minutes to add to your project, and it emits correct, standard man-pages. It also builds html man pages. Full details are in the README.txt, and there is an example project with makefile included herein.
Alternatives: there is already a program help2man but that is actually more complicated to use, and doesn't always get the output correct. Notably, it doesn't always escape text correctly from groff, it tends to create double-spaced text (blank-lines between every line), and it always re-wraps the output of -h, even when you may wish to prevent this. Furthermore, it's more complicated to use and less flexible. Also, man2html alone is designed to work as part of a CGI-script. so it adds unwanted headers; we remove them, set the font to fixed-width, and add spamblocks to any embedded email addresses.
NAME Your program's name BINARY The binary path in the source tree (once built, it is called with -h) SYNOPSIS A few words to summarise SECTION The section to place it in. Usually 1. See "man man" for a list. SOURCE The group of commands in which this belongs, if appropriate. DATE Documentation date. SEE_ALSO A list of other man pages, in the form: "manpageA (1)" "manpageB (1)" LEADING_SPACE Prevent re-wrapping of the output of -h, if desired. LICENSE License AUTHOR Author/email.
This was originally written as part of my PhD Infrared Camera system. It should be possible to adapt it for much wider usage.
Some selected files, from the tarball: Readme, the help_to_man script, and an example of the result.
README.txt
help_to_man.sh
demonstration.1
Return to all programs, site home.