-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.go
74 lines (61 loc) · 2.5 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package runkit
type (
RunKit struct {
Config Config
Readme string
Files map[string]string
src string
}
Config struct {
Default string `yaml:"default,omitempty" json:"default,omitempty"`
Actions []Action `yaml:"actions" json:"actions"`
}
Action struct {
isDefault bool
ID string `yaml:"id" json:"id"`
Desc string `yaml:"desc,omitempty" json:"desc,omitempty"`
Type ActionType `yaml:"type" json:"type"`
Command string `yaml:"cmd" json:"cmd,omitempty"`
Env []string `yaml:"env,omitempty" json:"env,omitempty"`
Options []Opt `yaml:"opts,omitempty" json:"opts,omitempty"`
Shell map[string]string `yaml:"shell,omitempty" json:"shell,omitempty"`
Dockerfile string `yaml:"dockerfile,omitempty" json:"dockerfile,omitempty"`
DockerfileContent string
}
Opt struct {
Name string `yaml:"name" json:"name"`
Type OptType `yaml:"type,omitempty" json:"type,omitempty"`
Description string `yaml:"desc" json:"desc,omitempty"`
NoPrompt bool `yaml:"no-prompt,omitempty" json:"no-prompt,omitempty"`
Prompt string `yaml:"prompt,omitempty" json:"prompt,omitempty"`
Required bool `yaml:"required,omitempty" json:"required,omitempty"`
Values []string `yaml:"values,omitempty" json:"values,omitempty"`
Default string `yaml:"default,omitempty" json:"default,omitempty"`
}
ActionType string
OptType string
LocalConfig struct {
AcceptTheRisk bool `yaml:"accept-the-risk,omitempty" json:"accept-the-risk,omitempty"`
Ref string `yaml:"ref,omitempty" json:"ref,omitempty"`
Images map[string]ConfigImage `yaml:"images,omitempty" json:"images,omitempty"`
}
ConfigImage struct {
Default string `yaml:"default,omitempty" json:"default,omitempty"`
AllActions ConfigAction `yaml:"all-actions,omitempty" json:"all-actions,omitempty"`
Actions map[string]ConfigAction `yaml:"actions,omitempty" json:"actions,omitempty"`
}
ConfigAction struct {
Opts map[string]string `yaml:"opts,omitempty" json:"opts,omitempty"`
}
)
const (
ActionTypeRun ActionType = "run"
ActionTypeBuild ActionType = "build"
OptTypeNotSet OptType = ""
OptTypeInput OptType = "input"
OptTypeSelect OptType = "select"
OptTypeConfirm OptType = "confirm"
)
func (action *Action) IsDefault() bool {
return action.isDefault
}