-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli_command_enumer.gen.go
94 lines (79 loc) · 2.85 KB
/
cli_command_enumer.gen.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Code generated by "enumer -type=CLICommand -trimprefix CLICommand -transform=snake -output cli_command_enumer.gen.go cli_command.go"; DO NOT EDIT.
package gdnotify
import (
"fmt"
"strings"
)
const _CLICommandName = "listserveregistermaintenancecleanupsync"
var _CLICommandIndex = [...]uint8{0, 4, 9, 17, 28, 35, 39}
const _CLICommandLowerName = "listserveregistermaintenancecleanupsync"
func (i CLICommand) String() string {
if i < 0 || i >= CLICommand(len(_CLICommandIndex)-1) {
return fmt.Sprintf("CLICommand(%d)", i)
}
return _CLICommandName[_CLICommandIndex[i]:_CLICommandIndex[i+1]]
}
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
func _CLICommandNoOp() {
var x [1]struct{}
_ = x[CLICommandList-(0)]
_ = x[CLICommandServe-(1)]
_ = x[CLICommandRegister-(2)]
_ = x[CLICommandMaintenance-(3)]
_ = x[CLICommandCleanup-(4)]
_ = x[CLICommandSync-(5)]
}
var _CLICommandValues = []CLICommand{CLICommandList, CLICommandServe, CLICommandRegister, CLICommandMaintenance, CLICommandCleanup, CLICommandSync}
var _CLICommandNameToValueMap = map[string]CLICommand{
_CLICommandName[0:4]: CLICommandList,
_CLICommandLowerName[0:4]: CLICommandList,
_CLICommandName[4:9]: CLICommandServe,
_CLICommandLowerName[4:9]: CLICommandServe,
_CLICommandName[9:17]: CLICommandRegister,
_CLICommandLowerName[9:17]: CLICommandRegister,
_CLICommandName[17:28]: CLICommandMaintenance,
_CLICommandLowerName[17:28]: CLICommandMaintenance,
_CLICommandName[28:35]: CLICommandCleanup,
_CLICommandLowerName[28:35]: CLICommandCleanup,
_CLICommandName[35:39]: CLICommandSync,
_CLICommandLowerName[35:39]: CLICommandSync,
}
var _CLICommandNames = []string{
_CLICommandName[0:4],
_CLICommandName[4:9],
_CLICommandName[9:17],
_CLICommandName[17:28],
_CLICommandName[28:35],
_CLICommandName[35:39],
}
// CLICommandString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func CLICommandString(s string) (CLICommand, error) {
if val, ok := _CLICommandNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _CLICommandNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to CLICommand values", s)
}
// CLICommandValues returns all values of the enum
func CLICommandValues() []CLICommand {
return _CLICommandValues
}
// CLICommandStrings returns a slice of all String values of the enum
func CLICommandStrings() []string {
strs := make([]string, len(_CLICommandNames))
copy(strs, _CLICommandNames)
return strs
}
// IsACLICommand returns "true" if the value is listed in the enum definition. "false" otherwise
func (i CLICommand) IsACLICommand() bool {
for _, v := range _CLICommandValues {
if i == v {
return true
}
}
return false
}