-verbose instead of -quiet, -quiet seems a better default

This commit is contained in:
Yann Hamon 2020-06-01 12:59:46 +02:00
parent 0ddf4e9a50
commit 1f019066c7
3 changed files with 18 additions and 27 deletions

View file

@ -15,7 +15,7 @@ type result struct {
type jsono struct {
withSummary bool
quiet bool
verbose bool
results []result
nValid, nInvalid, nErrors, nSkipped int
}
@ -23,7 +23,7 @@ type jsono struct {
func JSON(withSummary bool, quiet bool) Output {
return &jsono{
withSummary: withSummary,
quiet: quiet,
verbose: quiet,
results: []result{},
nValid: 0,
nInvalid: 0,
@ -54,7 +54,7 @@ func (o *jsono) Write(filename, kind, version string, err error, skipped bool) {
o.nSkipped++
}
if !o.quiet || (s != VALID && s != SKIPPED) {
if o.verbose || s == VALID || s == SKIPPED {
o.results = append(o.results, result{Filename: filename, Kind: kind, Version: version, Status: st, Msg: msg})
}
}

View file

@ -8,14 +8,14 @@ import (
type text struct {
sync.Mutex
withSummary bool
quiet bool
verbose bool
nValid, nInvalid, nErrors, nSkipped int
}
func Text(withSummary, quiet bool) Output {
func Text(withSummary, verbose bool) Output {
return &text{
withSummary: withSummary,
quiet: quiet,
verbose: verbose,
nValid: 0,
nInvalid: 0,
nErrors: 0,
@ -29,7 +29,7 @@ func (o *text) Write(filename, kind, version string, err error, skipped bool) {
switch status(err, skipped) {
case VALID:
if !o.quiet {
if !o.verbose {
fmt.Printf("%s - %s is valid\n", filename, kind)
}
o.nValid++
@ -40,7 +40,7 @@ func (o *text) Write(filename, kind, version string, err error, skipped bool) {
fmt.Printf("%s - %s failed validation: %s\n", filename, kind, err)
o.nErrors++
case SKIPPED:
if !o.quiet {
if o.verbose {
fmt.Printf("%s - %s skipped\n", filename, kind)
}
o.nSkipped++