From baf44a39234fefc16a673b2b8c4fa1d922008253 Mon Sep 17 00:00:00 2001 From: Anthony Fok Date: Sat, 21 Nov 2015 06:02:54 -0700 Subject: [PATCH] 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) --- man_docs.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/man_docs.go b/man_docs.go index 43fd2a53..4107808f 100644 --- a/man_docs.go +++ b/man_docs.go @@ -111,12 +111,13 @@ func fillHeader(header *GenManHeader, name string) { } func manPreamble(out *bytes.Buffer, header *GenManHeader, name, short, long string) { + dashName := strings.Replace(name, " ", "-", -1) fmt.Fprintf(out, `%% %s(%s)%s %% %s %% %s # NAME `, header.Title, header.Section, header.date, header.Source, header.Manual) - fmt.Fprintf(out, "%s \\- %s\n\n", name, short) + fmt.Fprintf(out, "%s \\- %s\n\n", dashName, short) fmt.Fprintf(out, "# SYNOPSIS\n") fmt.Fprintf(out, "**%s** [OPTIONS]\n\n", name) fmt.Fprintf(out, "# DESCRIPTION\n")