-
Notifications
You must be signed in to change notification settings - Fork 15
/
cmd_diff.go
48 lines (40 loc) · 973 Bytes
/
cmd_diff.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
package main
import (
"fmt"
"github.com/ipinfo/cli/lib/complete"
"github.com/ipinfo/cli/lib/complete/predict"
"github.com/ipinfo/mmdbctl/lib"
"github.com/spf13/pflag"
)
var completionsDiff = &complete.Command{
Flags: map[string]complete.Predictor{
"-h": predict.Nothing,
"--help": predict.Nothing,
"-s": predict.Nothing,
"--subnets": predict.Nothing,
"-r": predict.Nothing,
"--records": predict.Nothing,
},
}
func printHelpDiff() {
fmt.Printf(
`Usage: %s diff [<opts>] <old> <new>
Description:
Print subnet and record differences between two mmdb files (i.e. do set
difference `+"`"+"(new - old) U (old - new)"+"`"+`).
Options:
General:
--help, -h
show help.
--subnets, -s
show subnets difference.
--records, -r
show records difference.
`, progBase)
}
func cmdDiff() error {
f := lib.CmdDiffFlags{}
f.Init()
pflag.Parse()
return lib.CmdDiff(f, pflag.Args()[1:], printHelpDiff)
}