feat: simple secret parser

This commit is contained in:
张泊明518370910136 2024-09-10 22:23:12 -04:00
parent 2928e6321f
commit 9f0e9bf9f3
GPG Key ID: D47306D7062CDA9D
3 changed files with 36 additions and 2 deletions

View File

@ -11,9 +11,9 @@ func (e *Dummy) Run(cmds []stage.Cmd) ([]stage.ExecutorResult, error) {
var res []stage.ExecutorResult
for range cmds {
res = append(res, stage.ExecutorResult{
Status: stage.Status(envexec.StatusInvalid),
Status: stage.Status(envexec.StatusAccepted),
ExitStatus: 0,
Error: "I'm a dummy",
Error: "",
Time: 0,
Memory: 0,
RunTime: 0,

View File

@ -0,0 +1,9 @@
package secret
import "focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/stage"
var name = "secret"
func init() {
stage.RegisterParser(name, &Secret{})
}

View File

@ -0,0 +1,25 @@
package secret
import (
"focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/stage"
)
type Conf struct {
Secret string
}
type Secret struct{}
func (*Secret) Run(results []stage.ExecutorResult, confAny any) (
[]stage.ParserResult, bool, error,
) {
conf, err := stage.DecodeConf[Conf](confAny)
if err != nil {
return nil, true, err
}
var res []stage.ParserResult
for range results {
res = append(res, stage.ParserResult{Score: 0, Comment: conf.Secret})
}
return res, false, nil
}