Skip to content

Commit

Permalink
Merge pull request #2 from ianbruene/differ
Browse files Browse the repository at this point in the history
 Updated README with transfer of ownership and Differ info.
  • Loading branch information
ianbruene authored Jun 9, 2019
2 parents ecda353 + b27fcbb commit ba0ce24
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
5 changes: 0 additions & 5 deletions .travis.yml

This file was deleted.

40 changes: 32 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,43 @@
go-difflib
==========

[![Build Status](https://travis-ci.org/pmezard/go-difflib.png?branch=master)](https://travis-ci.org/pmezard/go-difflib)
[![GoDoc](https://godoc.org/github.com/pmezard/go-difflib/difflib?status.svg)](https://godoc.org/github.com/pmezard/go-difflib/difflib)
The previous owner of this project (pmezard) did not have the time to continue
working on it. Additionally I (ianbruene) needed additional ported features.

I have taken over maintenance and further development of the project

[![GoDoc](https://godoc.org/github.com/ianbruene/go-difflib/difflib?status.svg)](https://godoc.org/github.com/ianbruene/go-difflib/difflib)

Go-difflib is a partial port of python 3 difflib package. Its main goal
was to make unified and context diff available in pure Go, mostly for
testing purposes.
is to make unified and context diff available in pure Go.

The following class and functions (and related tests) have be ported:

* `SequenceMatcher`
* `Differ`
* `unified_diff()`
* `context_diff()`

## Installation

```bash
$ go get github.com/pmezard/go-difflib/difflib
$ go get github.com/ianbruene/go-difflib/difflib
```

### Quick Start
### UnifiedDiff Quick Start

Diffs are configured with Unified (or ContextDiff) structures, and can
be output to an io.Writer or returned as a string.

```Go
diff := UnifiedDiff{
diff := difflib.UnifiedDiff{
A: difflib.SplitLines("foo\nbar\n"),
B: difflib.SplitLines("foo\nbaz\n"),
FromFile: "Original",
ToFile: "Current",
Context: 3,
}
text, _ := GetUnifiedDiffString(diff)
text, _ := difflib.GetUnifiedDiffString(diff)
fmt.Printf(text)
```

Expand All @@ -48,3 +52,23 @@ would output:
+baz
```

### Differ Quick Start

Differ has been implemented primarily for the Compare() function at this time.

```Go
out, err := diff.Compare(
[]string{"foo\n", "bar\n", "baz\n"},
[]string{"foo\n", "bar1\n", "asdf\n", "baz\n"})
```

would output:

```
foo
- bar
+ bar1
? +
+ asdf
baz
```

0 comments on commit ba0ce24

Please sign in to comment.