writeExportReport writes what each run printed, after its full command and the schema files it checked against.
(w io.Writer, runs []runRecord)
| 174 | // writeExportReport writes what each run printed, after its full command and |
| 175 | // the schema files it checked against. |
| 176 | func writeExportReport(w io.Writer, runs []runRecord) error { |
| 177 | for i, run := range runs { |
| 178 | if i > 0 { |
| 179 | fmt.Fprintln(w) |
| 180 | } |
| 181 | fmt.Fprintf(w, "### Run %s at %s\n", run.ID, run.Time.UTC().Format(time.RFC3339)) |
| 182 | fmt.Fprintf(w, "$ %s\n", run.Command) |
| 183 | for _, f := range run.Schemas { |
| 184 | if f.Error != "" { |
| 185 | fmt.Fprintf(w, "%s: not loaded, so not checked: %s\n", f.Name, f.Error) |
| 186 | } else { |
| 187 | fmt.Fprintf(w, "%s: sha256 %s, %s\n", f.Name, f.SHA256, f.Path) |
| 188 | } |
| 189 | } |
| 190 | fmt.Fprintln(w) |
| 191 | if _, err := io.WriteString(w, run.Report); err != nil { |
| 192 | return err |
| 193 | } |
| 194 | } |
| 195 | return nil |
| 196 | } |
| 197 | |
| 198 | func exportReadme() string { |
| 199 | var b strings.Builder |