-
Notifications
You must be signed in to change notification settings - Fork 5
/
godiff.go
43 lines (32 loc) · 750 Bytes
/
godiff.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
go-diff is a tool checking semantic difference between source files.
Currently supported language:
- Go (fully)
If the language is not supported or parsing is failed for either file,
a line-to-line comparing is imposed.
*/
package main
import (
"flag"
"os"
"github.com/daviddengcn/go-diff/cmd"
"github.com/golangplus/fmt"
)
func usage() {
fmtp.Eprintfln("usage: go-diff [options] org-filename new-filename")
flag.PrintDefaults()
os.Exit(2)
}
func main() {
var options godiff.Options
flag.BoolVar(&options.NoColor, "no-color", false, "turn off the colors")
flag.Usage = usage
flag.Parse()
if flag.NArg() < 2 {
usage()
return
} // if
orgFn := flag.Arg(0)
newFn := flag.Arg(1)
godiff.Exec(orgFn, newFn, options)
}