mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-12-04 05:43:27 +01:00
Comments that restated names or narrated the code are gone, and multi-line ones are cut to a line of why. Only comments change: each edited Go file has the same token stream as before. winapi and abe come later.
36 lines
776 B
Go
36 lines
776 B
Go
package app
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
"text/tabwriter"
|
|
)
|
|
|
|
// The summary is not part of the output contract and never changes the exit status.
|
|
func Report(w io.Writer, s Summary) error {
|
|
tw := tabwriter.NewWriter(w, 0, 0, 2, ' ', 0)
|
|
fmt.Fprintln(tw, "Browser\tProfile\tCategory\tResult\tRecords\tDetail")
|
|
for _, r := range s.Results {
|
|
profile, cat := "-", "-"
|
|
if r.Profile != "" {
|
|
profile = r.Profile
|
|
}
|
|
if r.Category != 0 {
|
|
cat = r.Category.String()
|
|
}
|
|
fmt.Fprintf(tw, "%s\t%s\t%s\t%s\t%d\t%s\n", r.DirID, profile, cat, r.Outcome, r.Count, detail(r))
|
|
}
|
|
return tw.Flush()
|
|
}
|
|
|
|
func detail(r Result) string {
|
|
switch {
|
|
case r.Err != nil:
|
|
return r.Err.Error()
|
|
case r.Failed > 0:
|
|
return fmt.Sprintf("%d not recovered", r.Failed)
|
|
default:
|
|
return ""
|
|
}
|
|
}
|