feat: simple secret parser
This commit is contained in:
		
							parent
							
								
									2928e6321f
								
							
						
					
					
						commit
						9f0e9bf9f3
					
				|  | @ -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, | ||||
|  |  | |||
							
								
								
									
										9
									
								
								internal/parsers/secret/meta.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								internal/parsers/secret/meta.go
									
									
									
									
									
										Normal 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{}) | ||||
| } | ||||
							
								
								
									
										25
									
								
								internal/parsers/secret/parser.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								internal/parsers/secret/parser.go
									
									
									
									
									
										Normal 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 | ||||
| } | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user