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

Add --verbose flag, default to less verbose output (#1721)

This commit is contained in:
Tom Limoncelli
2022-08-20 20:59:02 -04:00
committed by GitHub
parent d907cdd2c2
commit 8bb63be8f5
7 changed files with 35 additions and 6 deletions

View File

@@ -66,6 +66,11 @@ var (
}
)
// SkinnyReport is true to to disable certain print statements.
// This is a hack until we have the new printer replacement. The long
// variable name is easy to grep for when we make the conversion.
var SkinnyReport = true
// ConsolePrinter is a handle for the console printer.
type ConsolePrinter struct {
Reader *bufio.Reader
@@ -117,7 +122,9 @@ func (c ConsolePrinter) StartDNSProvider(provider string, skip bool) {
if skip {
lbl = " (skipping)\n"
}
fmt.Fprintf(c.Writer, "----- DNS Provider: %s...%s\n", provider, lbl)
if !SkinnyReport {
fmt.Fprintf(c.Writer, "----- DNS Provider: %s...%s\n", provider, lbl)
}
}
// StartRegistrar is called at the start of each new registrar.
@@ -126,7 +133,9 @@ func (c ConsolePrinter) StartRegistrar(provider string, skip bool) {
if skip {
lbl = " (skipping)\n"
}
fmt.Fprintf(c.Writer, "----- Registrar: %s...%s\n", provider, lbl)
if !SkinnyReport {
fmt.Fprintf(c.Writer, "----- Registrar: %s...%s\n", provider, lbl)
}
}
// EndProvider is called at the end of each provider.
@@ -139,6 +148,9 @@ func (c ConsolePrinter) EndProvider(numCorrections int, err error) {
if numCorrections == 1 {
plural = ""
}
if (SkinnyReport) && (numCorrections == 0) {
return
}
fmt.Fprintf(c.Writer, "%d correction%s\n", numCorrections, plural)
}
}