func printOptionsReST(buf *bytes.Buffer, cmd *cobra.Command, name string) error { … } // defaultLinkHandler for default ReST hyperlink markup func defaultLinkHandler(name, ref string) string { … } // GenReST creates reStructured Text output. func GenReST(cmd *cobra.Command, w io.Writer) error { … } // GenReSTCustom creates custom reStructured Text output. func GenReSTCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string, string) string) error { … } // GenReSTTree will generate a ReST page for this command and all // descendants in the directory given. // This function may not work correctly if your command names have `-` in them. // If you have `cmd` with two subcmds, `sub` and `sub-third`, // and `sub` has a subcommand called `third`, it is undefined which // help output will be in the file `cmd-sub-third.1`. func GenReSTTree(cmd *cobra.Command, dir string) error { … } // GenReSTTreeCustom is the same as GenReSTTree, but // with custom filePrepender and linkHandler. func GenReSTTreeCustom(cmd *cobra.Command, dir string, filePrepender func(string) string, linkHandler func(string, string) string) error { … } // indentString adapted from: https://github.com/kr/text/blob/main/indent.go func indentString(s, p string) string { … }