| commit | 00743322d6fead389f801b41367c005d6f8e3cdf | [log] [tgz] |
|---|---|---|
| author | Aryan Naraghi <[email protected]> | Fri Nov 23 05:14:31 2012 |
| committer | Aryan Naraghi <[email protected]> | Fri Nov 23 05:14:31 2012 |
| tree | dbc80423c76c9ea621279ae12b8375dd69216ce2 | |
| parent | c058f18d3162d46d4389d12956ca292c56d8f1f2 [diff] |
Improved the README and made some minor changes to the demo.
difflib is a simple library written in Go for diffing two sequences of text.
To install, issue:
go get github.com/aryann/difflib
To start using difflib, create a new file in your workspace and import difflib:
import (
...
"fmt"
"github.com/aryann/difflib"
...
)
Then call either difflib.Diff or difflib.HTMLDiff:
fmt.Println(difflib.HTMLDiff([]string{"one", "two", "three"}, []string{"two", "four", "three"}))
If you'd like more control over the output, see how the function HTMLDiff relies on Diff in difflib.go.
There is a demo application in the difflib_demo directory. To run it, navigate to your $GOPATH and run:
go run src/github.com/aryann/difflib/difflib_server/difflib_demo.go <file-1> <file-2>
Where <file-1> and <file-2> are two text files you'd like to diff. The demo will launch a web server that will contain a table of the diff results.