INNER CODE UNIT · Go
insertMetadataSection
dropbox/dbxcli · tools/gen-docs/main.go:123
func insertMetadataSection(contents []byte, section []byte) []byte {
marker := []byte("\n### SEE ALSO\n\n")
index := bytes.Index(contents, marker)
if index == -1 {
return append(append(contents, '\n'), section...)
}
result := make([]byte, 0, len(contents)+len(section)+1)
result = append(result, contents[:index]...)
result = append(result, '\n')
result = append(result, section...)
result = append(result, contents[index:]...)
return result
}
func commandMetadataSection(command *cobra.Command) []byte {
manifest := cmd.CommandManifestFor(command)
var buf bytes.Buffer