-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
where are the non pretty options? #137
Comments
looks like it would just be like this: func DiffText(diffs []Diff) string {
var buf strings.Builder
for _, diff := range diffs {
buf.WriteString(diff.Text)
}
return buf.String()
} |
What output do you get from that? I just get the same text as the colored output without color. Which is meaningless because there are no
With the code above I get this output:
|
good catch, looks like this would do it: func diff_text(diffs []Diff) string {
var b strings.Builder
for _, diff := range diffs {
switch diff.Type {
case DiffInsert:
b.WriteByte('+')
b.WriteString(diff.Text)
case DiffDelete:
b.WriteByte('-')
b.WriteString(diff.Text)
case DiffEqual:
b.WriteString(diff.Text)
}
}
return b.String()
} |
@sergi I miss that feature, too |
btw, I use that package now. It has a simple way to get a unified diff: https://pkg.go.dev/github.com/akedrou/textdiff#Unified |
I see these:
https://godocs.io/github.com/sergi/go-diff/diffmatchpatch#DiffMatchPatch.DiffPrettyHtml
https://godocs.io/github.com/sergi/go-diff/diffmatchpatch#DiffMatchPatch.DiffPrettyText
how to create a diff without color?
The text was updated successfully, but these errors were encountered: