-
Notifications
You must be signed in to change notification settings - Fork 7
/
types.go
56 lines (49 loc) · 966 Bytes
/
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
package types
type StringFlag struct {
Name string
Short string
DefaultValue string
Usage string
Prompt string
Required bool
ValidateFn func(input string) error
}
type BoolFlag struct {
Name string
Short string
DefaultValue bool
Usage string
Prompt string
Required bool
}
type IntFlag struct {
Name string
Short string
DefaultValue int64
Usage string
Prompt string
Required bool
ValidateFn func(input string) error
}
type Option[T any] interface {
Name() string
Value() T
StringValue() string
}
type OptionFlag[T any] struct {
Name string
Short string
DefaultValue Option[T]
Options []Option[T]
Usage string
Prompt string
Required bool
ValidateFn func(input string) error
}
type CmdConfig struct {
Name string
Short string
}
func (c CmdConfig) PromptString() string {
return c.Short
}