From 7648dde9da0fc09193f5522db33da3e81f7fb082 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Thu, 10 Oct 2024 18:47:01 -0400 Subject: [PATCH] feat(parser/resultdetail): show files --- internal/parser/resultdetail/parser.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/parser/resultdetail/parser.go b/internal/parser/resultdetail/parser.go index f4ae655..64bb340 100644 --- a/internal/parser/resultdetail/parser.go +++ b/internal/parser/resultdetail/parser.go @@ -13,6 +13,7 @@ type Conf struct { ShowTime bool `default:"true"` ShowMemory bool `default:"true"` ShowRunTime bool `default:"false"` + ShowFiles []string } type ResultDetail struct{} @@ -44,6 +45,15 @@ func (*ResultDetail) Run(results []stage.ExecutorResult, confAny any) ( if conf.ShowRunTime { comment += fmt.Sprintf("RunTime: %d\n", result.RunTime) } + for _, file := range conf.ShowFiles { + content, ok := result.Files[file] + comment += fmt.Sprintf("File: `%s`.\n", file) + if ok { + comment += fmt.Sprintf("```%s```\n", content) + } else { + comment += "Not found.\n" + } + } res = append(res, stage.ParserResult{ Score: conf.Score, Comment: comment,