Commit graph

11 commits

Author SHA1 Message Date
Frank Schroeder b3f29e98e6 Issue #195: Move doc generation into separate pkg
* Move man_docs and md_docs into new doc pkg
* Replace *bytes.Buffer with io.Writer
* Replace c == cmd.helpCommand with c.IsHelpCommand()
* Remove redundant len(children) == 0 check in HasSeeAlso
* Duplicate test setup for doc generation
2015-12-24 09:01:59 -05:00
Anthony Fok 10546a043b Remove extraneous comma at the end of SEE ALSO list 2015-11-21 06:23:56 -07:00
Anthony Fok 9c32fb42ec Reset man page title when necessary in GenManTree
If the user did not define header.Title when calling GenManTree(),
reset it after each call to GenMan(), otherwise the entire man page tree
would be stuck with the full command name that was calculated for the
first man page, leaving all subsequent man pages with an identical
but incorrect title.
2015-11-21 06:18:37 -07:00
Anthony Fok 3bd84ba55c Ensure man page title is uppercase and has rootcmd
As described in http://man7.org/linux/man-pages/man7/man-pages.7.html
2015-11-21 06:13:53 -07:00
Anthony Fok baf44a3923 Fix Lintian warning: manpage-has-bad-whatis-entry
This patch fixes the problem where lexgrog fails to parse the NAME section
when the provided command contains space, e.g. "rootcmd subcmd".

Explanation from Lintian:

 Each manual page should start with a "NAME" section, which lists the
 name and a brief description of the page separated by "\-".  The "NAME"
 section is parsed by lexgrog and used to generate a database that's
 queried by commands like apropos and whatis.  This tag indicates that
 lexgrog was unable to parse the NAME section of this manual page.

 For manual pages that document multiple programs, functions, files, or
 other things, the part before "\-" should list each separated by a comma
 and a space.  Each thing listed must not contain spaces; a man page for a
 two-part command like "fs listacl" must use something like "fs_listacl"
 in the "NAME" section so that it can be parsed by lexgrog.

Ref: lexgrog(1), groff_man(7), groff_mdoc(7)
2015-11-21 06:12:14 -07:00
Austin Riendeau 5144a3aa19 add a flag to disable autogen tag in man and markdown generators
Inherits from parent commands all the way to root
2015-11-08 09:58:38 -05:00
Eric Paris 3eac1434ef Update IsAvailableCommand checks
This slightly changes IsAvailableCommand in that a non-runnable command
with a runnable subcommand is now 'Available'

We also use IsAvailableCommand in the rest of the codebase instead of
half kinda sorta doing it incorrectly other places.
2015-09-08 22:48:12 -04:00
Eric Paris edcf765d9f Mangen: allow callers to specify header information
We previously had this weak argument called projectName which let you
set a single part of a man page header. Instead do the best we can if
the caller doesn't pass us anything, but let the caller specify anything
they want.
2015-09-08 18:52:09 -04:00
Eric Paris cfecf1379c manpage generation: Make sure parent in SEE ALSO has dashes
The CommandPath() for a parent might have a space (if .Parent() != .Root())
so we need to replace those spaces with `-`
2015-09-08 12:32:15 -04:00
António Meireles f5d2d93abf turn generated man pages non k8s specific.
Signed-off-by: António Meireles <antonio.meireles@reformi.st>
2015-08-28 17:34:11 +01:00
Eric Paris 9e7788657f Auto generation of a man page 2015-08-21 01:10:13 -07:00