MCPcopy
hub / github.com/homeport/dyff / prefixChangeBlock

Method prefixChangeBlock

pkg/dyff/output_diff_syntax.go:146–162  ·  view source on GitHub ↗
(detailOutput string, blockPrefix rune)

Source from the content-addressed store, hash-verified

144}
145
146func (report *DiffSyntaxReport) prefixChangeBlock(detailOutput string, blockPrefix rune) string {
147 // trim newline from the end
148 detailOutput = strings.TrimSpace(detailOutput)
149
150 var output bytes.Buffer
151
152 // the first line is the change type, we don't want to prefix that
153 firstLine := strings.Split(detailOutput, "\n")[0]
154 // Remove the ADDITION rune from the first line
155 report.writeTextBlocks(&output, 0, firstLine)
156
157 detailOutput = strings.Replace(detailOutput, firstLine+"\n", "", 1)
158
159 report.writeTextBlocks(&output, 0, createStringWithContinuousPrefix(fmt.Sprintf("%c ", blockPrefix), detailOutput, 0))
160
161 return strings.TrimSpace(output.String())
162}

Callers 1

Calls 3

writeTextBlocksMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected