Skip to content
This repository was archived by the owner on Nov 14, 2024. It is now read-only.

feat: enable pretty output #16

Merged
merged 8 commits into from
Sep 14, 2021
Next Next commit
feat: humanwriter: prefix with result.Name if present
  • Loading branch information
johnstcn committed Sep 13, 2021
commit 14baaca3a38579acadf2ece746072e34651e8b03
7 changes: 6 additions & 1 deletion internal/humanwriter/human.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ func (w *HumanResultWriter) WriteResult(result *api.CheckResult) error {
return err
}

_, err = fmt.Fprintln(w.out, prefix, result.Summary)
namePrefix := ""
if result.Name != "" {
namePrefix = fmt.Sprintf(" [%s]", result.Name)
}

_, err = fmt.Fprintf(w.out, "%s%s %s\n", prefix, namePrefix, result.Summary)
return err
}
4 changes: 2 additions & 2 deletions internal/humanwriter/human_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ func TestHumanWriter(t *testing.T) {
var expected string
switch mode {
case humanwriter.OutputModeEmoji:
expected = "👍 human writer check test\n" +
expected = "👍 [check-test] human writer check test\n" +
"🔔 summary\n" +
"👎 failed message\n" +
"⚠️ \n" +
"⏩ skipped check\n"
case humanwriter.OutputModeText:
expected = "PASS human writer check test\n" +
expected = "PASS [check-test] human writer check test\n" +
"INFO summary\n" +
"FAIL failed message\n" +
"WARN \n" +
Expand Down