1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

Enable --diff2 flag anywhere on the command line (#2281)

Co-authored-by: Tom Limoncelli <tal@whatexit.org>
This commit is contained in:
Tom Limoncelli
2023-04-16 14:46:39 -04:00
committed by GitHub
parent 57f3576df1
commit bcf590f649
4 changed files with 113 additions and 71 deletions

View File

@ -10,6 +10,7 @@ import (
"github.com/StackExchange/dnscontrol/v3/models"
"github.com/StackExchange/dnscontrol/v3/pkg/credsfile"
"github.com/StackExchange/dnscontrol/v3/pkg/diff2"
"github.com/StackExchange/dnscontrol/v3/pkg/nameservers"
"github.com/StackExchange/dnscontrol/v3/pkg/normalize"
"github.com/StackExchange/dnscontrol/v3/pkg/notifications"
@ -67,6 +68,11 @@ func (args *PreviewArgs) flags() []cli.Flag {
Destination: &args.Full,
Usage: `Add headings, providers names, notifications of no changes, etc`,
})
flags = append(flags, &cli.BoolFlag{
Name: "diff2",
Destination: &diff2.EnableDiff2,
Usage: `Enable replacement diff algorithm`,
})
return flags
}
@ -115,6 +121,12 @@ func run(args PreviewArgs, push bool, interactive bool, out printer.CLI) error {
// This is a hack until we have the new printer replacement.
printer.SkinnyReport = !args.Full
if diff2.EnableDiff2 {
printer.Println("INFO: Diff2 algorithm in use.")
} else {
printer.Println("INFO: Old diff algorithm in use. Please test --diff2 as it will be the default in releases after 2023-05-07. See https://github.com/StackExchange/dnscontrol/issues/2262")
}
cfg, err := GetDNSConfig(args.GetDNSConfigArgs)
if err != nil {
return err