feat(parser/resultdetail): rename MaxFilesLength => MaxFileLength
All checks were successful
submodules sync / sync (push) Successful in 36s
build / build (push) Successful in 1m58s
build / trigger-build-image (push) Successful in 8s

This commit is contained in:
张泊明518370910136 2024-11-04 19:06:17 -05:00
parent f66ab6d493
commit 6b99cc41a9
GPG Key ID: D47306D7062CDA9D

View File

@ -15,7 +15,7 @@ type Conf struct {
ShowMemory bool `default:"true"` ShowMemory bool `default:"true"`
ShowRunTime bool `default:"false"` ShowRunTime bool `default:"false"`
ShowFiles []string ShowFiles []string
MaxFilesLength int `default:"65536"` MaxFileLength int `default:"65536"`
} }
type ResultDetail struct{} type ResultDetail struct{}
@ -57,8 +57,8 @@ func (*ResultDetail) Run(results []stage.ExecutorResult, confAny any) (
content, ok := result.Files[file] content, ok := result.Files[file]
comment += fmt.Sprintf("File `%s`:\n", file) comment += fmt.Sprintf("File `%s`:\n", file)
if ok { if ok {
if conf.MaxFilesLength > 0 && len(content) > conf.MaxFilesLength { if conf.MaxFileLength > 0 && len(content) > conf.MaxFileLength {
content = content[:conf.MaxFilesLength] + "\n\n(truncated)" content = content[:conf.MaxFileLength] + "\n\n(truncated)"
} }
comment += fmt.Sprintf("```\n%s\n```\n", content) comment += fmt.Sprintf("```\n%s\n```\n", content)
} else { } else {