88 lines
2.0 KiB
Go
88 lines
2.0 KiB
Go
// Code generated by go-enum DO NOT EDIT.
|
|
// Version: 0.6.1
|
|
// Revision: a6f63bddde05aca4221df9c8e9e6d7d9674b1cb4
|
|
// Build Date: 2025-03-18T23:42:14Z
|
|
// Built By: goreleaser
|
|
|
|
package fnamest
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
const (
|
|
// Default is a FnameST of type default.
|
|
Default FnameST = "default"
|
|
// Message is a FnameST of type message.
|
|
Message FnameST = "message"
|
|
)
|
|
|
|
var ErrInvalidFnameST = fmt.Errorf("not a valid FnameST, try [%s]", strings.Join(_FnameSTNames, ", "))
|
|
|
|
var _FnameSTNames = []string{
|
|
string(Default),
|
|
string(Message),
|
|
}
|
|
|
|
// FnameSTNames returns a list of possible string values of FnameST.
|
|
func FnameSTNames() []string {
|
|
tmp := make([]string, len(_FnameSTNames))
|
|
copy(tmp, _FnameSTNames)
|
|
return tmp
|
|
}
|
|
|
|
// FnameSTValues returns a list of the values for FnameST
|
|
func FnameSTValues() []FnameST {
|
|
return []FnameST{
|
|
Default,
|
|
Message,
|
|
}
|
|
}
|
|
|
|
// String implements the Stringer interface.
|
|
func (x FnameST) String() string {
|
|
return string(x)
|
|
}
|
|
|
|
// IsValid provides a quick way to determine if the typed value is
|
|
// part of the allowed enumerated values
|
|
func (x FnameST) IsValid() bool {
|
|
_, err := ParseFnameST(string(x))
|
|
return err == nil
|
|
}
|
|
|
|
var _FnameSTValue = map[string]FnameST{
|
|
"default": Default,
|
|
"message": Message,
|
|
}
|
|
|
|
// ParseFnameST attempts to convert a string to a FnameST.
|
|
func ParseFnameST(name string) (FnameST, error) {
|
|
if x, ok := _FnameSTValue[name]; ok {
|
|
return x, nil
|
|
}
|
|
// Case insensitive parse, do a separate lookup to prevent unnecessary cost of lowercasing a string if we don't need to.
|
|
if x, ok := _FnameSTValue[strings.ToLower(name)]; ok {
|
|
return x, nil
|
|
}
|
|
return FnameST(""), fmt.Errorf("%s is %w", name, ErrInvalidFnameST)
|
|
}
|
|
|
|
// Set implements the Golang flag.Value interface func.
|
|
func (x *FnameST) Set(val string) error {
|
|
v, err := ParseFnameST(val)
|
|
*x = v
|
|
return err
|
|
}
|
|
|
|
// Get implements the Golang flag.Getter interface func.
|
|
func (x *FnameST) Get() interface{} {
|
|
return *x
|
|
}
|
|
|
|
// Type implements the github.com/spf13/pFlag Value interface.
|
|
func (x *FnameST) Type() string {
|
|
return "FnameST"
|
|
}
|