Skip to content
Myr

Reset man page title when necessary in GenManTree

Before adoption: this commit came in with the history the project adopted, so no landing records it.

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.

authored by Anthony Fok · committed by Anthony Fok · parent 3bd84ba · Browse files · 1 file+6 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−0 removed

  • other:+6 added−0 removed

1 file+6 added−0 removed

modified:man_docs.go+6 added
45 unmodified lines
46 GenManTree(c, header, dir)47 }48 out := new(bytes.Buffer)4950 needToResetTitle := header.Title == ""5152 cmd.GenMan(header, out)5354 if needToResetTitle {55 header.Title = ""56 }5758 filename := cmd.CommandPath()59 filename = dir + strings.Replace(filename, " ", "-", -1) + ".1"60 outFile, err := os.Create(filename)61 if err != nil {
163 unmodified lines