-
Notifications
You must be signed in to change notification settings - Fork 67
/
types.go
63 lines (49 loc) 路 1.41 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
package installer
import (
"errors"
"github.com/spf13/pflag"
)
type RunEnvironmentType string
var _ pflag.Value = (*RunEnvironmentType)(nil)
const (
DockerRunEnvironmentType RunEnvironmentType = "docker"
KubernetesRunEnvironmentType RunEnvironmentType = "kubernetes"
NoneRunEnvironmentType RunEnvironmentType = "none" // stands for "no option chosen"
)
func (e *RunEnvironmentType) String() string {
return string(*e)
}
func (e *RunEnvironmentType) Set(v string) error {
switch v {
case "docker", "kubernetes":
*e = RunEnvironmentType(v)
return nil
default:
return errors.New(`must be "docker" or "kubernetes"`)
}
}
func (e *RunEnvironmentType) Type() string {
return "(docker|kubernetes)"
}
type InstallationModeType string
var _ pflag.Value = (*InstallationModeType)(nil)
const (
WithDemoInstallationModeType InstallationModeType = "with-demo"
WithoutDemoInstallationModeType InstallationModeType = "just-tracetest"
NotChosenInstallationModeType InstallationModeType = "none" // stands for "no option chosen"
)
func (e *InstallationModeType) String() string {
return string(*e)
}
func (e *InstallationModeType) Set(v string) error {
switch v {
case "with-demo", "just-tracetest":
*e = InstallationModeType(v)
return nil
default:
return errors.New(`must be "with-demo" or "just-tracetest"`)
}
}
func (e *InstallationModeType) Type() string {
return "(with-demo|just-tracetest)"
}