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

Don't count diff2.REPORT (informational warnings) as a "correction" (#2361)

Co-authored-by: Tom Limoncelli <tal@whatexit.org>
This commit is contained in:
Tom Limoncelli
2023-05-16 10:42:08 -04:00
committed by GitHub
parent 84e39b4ae2
commit 66a76c44c1
10 changed files with 90 additions and 61 deletions

View File

@@ -19,6 +19,7 @@ type CLI interface {
StartRegistrar(name string, skip bool)
PrintCorrection(n int, c *models.Correction)
PrintReport(n int, c *models.Correction) // Print corrections that are diff2.REPORT
EndCorrection(err error)
PromptToRun() bool
}
@@ -89,6 +90,13 @@ func (c ConsolePrinter) PrintCorrection(i int, correction *models.Correction) {
fmt.Fprintf(c.Writer, "#%d: %s\n", i+1, correction.Msg)
}
// PrintReport is called to print/format each non-mutating correction (diff2.REPORT).
func (c ConsolePrinter) PrintReport(i int, correction *models.Correction) {
// When diff1 is eliminated:
//fmt.Fprintf(c.Writer, "INFO#%d: %s\n", i+1, correction.Msg)
fmt.Fprintf(c.Writer, "INFO: %s\n", correction.Msg)
}
// PromptToRun prompts the user to see if they want to execute a correction.
func (c ConsolePrinter) PromptToRun() bool {
fmt.Fprint(c.Writer, "Run? (Y/n): ")