MCPcopy Create free account
hub / github.com/cli/cli / printReport

Function printReport

script/ghmock/report.go:20–48  ·  view source on GitHub ↗

printReport writes what each binary did. With more than one binary, it then lists how each one differs from the first. notes say which schema checks couldn't run.

(w io.Writer, opts runOptions, results []runResult, notes []string)

Source from the content-addressed store, hash-verified

18// lists how each one differs from the first. notes say which schema checks
19// couldn't run.
20func printReport(w io.Writer, opts runOptions, results []runResult, notes []string) {
21 quoted := make([]string, len(opts.args))
22 for i, arg := range opts.args {
23 quoted[i] = shellQuote(arg)
24 }
25 command := "$ gh " + strings.Join(quoted, " ")
26 if len(results) == 1 {
27 fmt.Fprintf(w, "%s - %s\n", results[0].version, results[0].path)
28 printResult(w, command, results[0])
29 printNotes(w, notes)
30 return
31 }
32
33 for i, res := range results {
34 suffix := ""
35 if i == 0 {
36 suffix = " (baseline)"
37 }
38 fmt.Fprintf(w, "=== [%d] %s - %s%s\n", i+1, res.version, res.path, suffix)
39 printResult(w, command, res)
40 fmt.Fprintln(w)
41 }
42
43 fmt.Fprintln(w, "=== differences from [1]")
44 for i := 1; i < len(results); i++ {
45 printDifferences(w, results[0], results[i], i+1)
46 }
47 printNotes(w, notes)
48}
49
50func printNotes(w io.Writer, notes []string) {
51 if len(notes) == 0 {

Callers 3

runAllFunction · 0.85
TestRunAllFunction · 0.85
TestPrintReportFunction · 0.85

Calls 5

printResultFunction · 0.85
printNotesFunction · 0.85
printDifferencesFunction · 0.85
JoinMethod · 0.80
shellQuoteFunction · 0.70

Tested by 2

TestRunAllFunction · 0.68
TestPrintReportFunction · 0.68