diff

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(oldContent, newContent, filePath string) string

Generate produces a unified diff string between oldContent and newContent. It uses a simple LCS-based diff algorithm with 3 lines of context.

func GenerateForDelete

func GenerateForDelete(content, filePath string) string

GenerateForDelete generates a diff showing the entire file as removed.

func GenerateForNewFile

func GenerateForNewFile(content, filePath string) string

GenerateForNewFile generates a diff showing the entire file as added.

func Render

func Render(unifiedDiff string) string

Render takes a unified diff string and returns it with ANSI color codes. - "---" and "+++" header lines: bold - "@@" hunk headers: cyan - "-" removed lines: red - "+" added lines: green - context lines: default (no color)

func RenderCompact

func RenderCompact(unifiedDiff string, maxLines int) string

RenderCompact is like Render but truncates output to maxLines lines. If the diff exceeds maxLines, a "... (N more lines)" message is appended.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL