You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
packer/packer/fixconfigmode_enumer.go

83 lines
2.2 KiB

// Code generated by "enumer -type FixConfigMode"; DO NOT EDIT.
package packer
import (
"fmt"
"strings"
)
const _FixConfigModeName = "StdoutInplaceDiff"
var _FixConfigModeIndex = [...]uint8{0, 6, 13, 17}
const _FixConfigModeLowerName = "stdoutinplacediff"
func (i FixConfigMode) String() string {
if i < 0 || i >= FixConfigMode(len(_FixConfigModeIndex)-1) {
return fmt.Sprintf("FixConfigMode(%d)", i)
}
return _FixConfigModeName[_FixConfigModeIndex[i]:_FixConfigModeIndex[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 _FixConfigModeNoOp() {
var x [1]struct{}
_ = x[Stdout-(0)]
_ = x[Inplace-(1)]
_ = x[Diff-(2)]
}
var _FixConfigModeValues = []FixConfigMode{Stdout, Inplace, Diff}
var _FixConfigModeNameToValueMap = map[string]FixConfigMode{
_FixConfigModeName[0:6]: Stdout,
_FixConfigModeLowerName[0:6]: Stdout,
_FixConfigModeName[6:13]: Inplace,
_FixConfigModeLowerName[6:13]: Inplace,
_FixConfigModeName[13:17]: Diff,
_FixConfigModeLowerName[13:17]: Diff,
}
var _FixConfigModeNames = []string{
_FixConfigModeName[0:6],
_FixConfigModeName[6:13],
_FixConfigModeName[13:17],
}
// FixConfigModeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func FixConfigModeString(s string) (FixConfigMode, error) {
if val, ok := _FixConfigModeNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _FixConfigModeNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to FixConfigMode values", s)
}
// FixConfigModeValues returns all values of the enum
func FixConfigModeValues() []FixConfigMode {
return _FixConfigModeValues
}
// FixConfigModeStrings returns a slice of all String values of the enum
func FixConfigModeStrings() []string {
strs := make([]string, len(_FixConfigModeNames))
copy(strs, _FixConfigModeNames)
return strs
}
// IsAFixConfigMode returns "true" if the value is listed in the enum definition. "false" otherwise
func (i FixConfigMode) IsAFixConfigMode() bool {
for _, v := range _FixConfigModeValues {
if i == v {
return true
}
}
return false
}