-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
50 lines (43 loc) · 1020 Bytes
/
main.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
44
45
46
47
48
49
50
package main
import (
"fmt"
"log"
"os"
"github.com/arithran/covercmp/compare"
"github.com/arithran/covercmp/driver/golang"
"github.com/urfave/cli/v2"
)
const (
goUsage = "covercmp go before.txt after.txt"
goUsageText = `
Each input file should be from:
'go test -count=1 -cover > [before,after].txt'
Covercmp compares before and after for each unit test runs.
'covercmp go before.txt after.txt'
`
)
func main() {
app := &cli.App{
Name: "covercmp",
Usage: "The covercmp command displays code coverage changes between unit test runs",
Commands: []*cli.Command{
{
Name: "go",
Usage: goUsage,
UsageText: goUsageText,
Action: func(c *cli.Context) error {
if c.NArg() < 2 {
return fmt.Errorf("not enough arguments usage:\n %s", goUsage)
}
return compare.Cmp(golang.New(), c.Args().Get(0), c.Args().Get(1))
},
},
// Add other language support in the future
// ...
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}