(contents []byte, section []byte)
| 121 | } |
| 122 | |
| 123 | func insertMetadataSection(contents []byte, section []byte) []byte { |
| 124 | marker := []byte("\n### SEE ALSO\n\n") |
| 125 | index := bytes.Index(contents, marker) |
| 126 | if index == -1 { |
| 127 | return append(append(contents, '\n'), section...) |
| 128 | } |
| 129 | |
| 130 | result := make([]byte, 0, len(contents)+len(section)+1) |
| 131 | result = append(result, contents[:index]...) |
| 132 | result = append(result, '\n') |
| 133 | result = append(result, section...) |
| 134 | result = append(result, contents[index:]...) |
| 135 | return result |
| 136 | } |
| 137 | |
| 138 | func commandMetadataSection(command *cobra.Command) []byte { |
| 139 | manifest := cmd.CommandManifestFor(command) |
no outgoing calls
no test coverage detected