Diffparser
A Golang package for parsing git diffs
Install / Use
/learn @waigani/DiffparserREADME
DiffParser
DiffParser is a Golang package which parse's a git diff.
Install
go get github.com/waigani/diffparser
Usage Example
package main
import (
"fmt"
"github.com/waigani/diffparser"
)
// error handling left out for brevity
func main() {
byt, _ := ioutil.ReadFile("example.diff")
diff, _ := diffparser.Parse(string(byt))
// You now have a slice of files from the diff,
file := diff.Files[0]
// diff hunks in the file,
hunk := file.Hunks[0]
// new and old ranges in the hunk
newRange := hunk.NewRange
// and lines in the ranges.
line := newRange.Lines[0]
}
More Examples
See diffparser_test.go for further examples.
Related Skills
node-connect
341.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
341.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.4kCommit, push, and open a PR
