feat(parser/resultdetail): files in code block conf
This commit is contained in:
parent
d76270d1ba
commit
b3f76c24a7
|
@ -15,6 +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
|
||||||
|
FilesInCodeBlock bool `default:"true"`
|
||||||
MaxFileLength int `default:"65536"`
|
MaxFileLength int `default:"65536"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +61,11 @@ func (*ResultDetail) Run(results []stage.ExecutorResult, confAny any) (
|
||||||
if conf.MaxFileLength > 0 && len(content) > conf.MaxFileLength {
|
if conf.MaxFileLength > 0 && len(content) > conf.MaxFileLength {
|
||||||
content = content[:conf.MaxFileLength] + "\n\n(truncated)"
|
content = content[:conf.MaxFileLength] + "\n\n(truncated)"
|
||||||
}
|
}
|
||||||
|
if conf.FilesInCodeBlock {
|
||||||
comment += fmt.Sprintf("```\n%s\n```\n", content)
|
comment += fmt.Sprintf("```\n%s\n```\n", content)
|
||||||
|
} else {
|
||||||
|
comment += fmt.Sprintf("%s\n", content)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
comment += "Not found\n"
|
comment += "Not found\n"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user