values

package
v0.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBase64Bytes added in v0.12.0

func NewBase64Bytes(val []byte, p *[]byte) *base64BytesValue

NewBase64Bytes creates a pflag.Value that parses base64-encoded textual input.

func NewDuration

func NewDuration(val time.Duration, p *time.Duration) *durationValue

NewDuration creates a new durationValue.

func NewHexBytes added in v0.12.0

func NewHexBytes(val []byte, p *[]byte) *hexBytesValue

NewHexBytes creates a pflag.Value that parses hex-encoded textual input.

func NewIP added in v0.12.0

func NewIP(val net.IP, p *net.IP) *ipValue

func NewIPMask added in v0.12.0

func NewIPMask(val net.IPMask, p *net.IPMask) *ipMaskValue

func NewIPNet added in v0.12.0

func NewIPNet(val net.IPNet, p *net.IPNet) *ipNetValue

func NewIPSlice added in v0.12.0

func NewIPSlice(val []net.IP, p *[]net.IP) *ipSliceValue

func NewInt

func NewInt(p *int) *intValue

func NewRawBytes added in v0.12.0

func NewRawBytes(val []byte, p *[]byte) *rawBytesValue

NewRawBytes creates a pflag.Value that keeps raw textual bytes semantics.

func NewString

func NewString(p *string) *stringValue

func ParseIPv4Mask added in v0.12.0

func ParseIPv4Mask(s string) net.IPMask

ParseIPv4Mask parses masks written as dotted decimal or hex bytes (e.g. ffffff00).

Types

type EnumStringValue added in v0.16.0

type EnumStringValue[E ~string] struct {
	// contains filtered or unexported fields
}

EnumStringValue implements pflag.Value for string-based enum types. It validates on Set() that the value is in the allowed set, supports case-insensitive matching, and exposes allowed values via EnumValues().

func NewEnumString added in v0.16.0

func NewEnumString[E ~string](target *E, values map[E][]string) *EnumStringValue[E]

NewEnumString creates an EnumStringValue for the given target pointer. values maps each enum constant to its string representations; the first string in each slice is canonical, additional strings are aliases.

func (*EnumStringValue[E]) EnumValues added in v0.16.0

func (v *EnumStringValue[E]) EnumValues() []string

EnumValues returns the sorted canonical names for this enum. Satisfies the structcli.EnumValuer interface.

func (*EnumStringValue[E]) Set added in v0.16.0

func (v *EnumStringValue[E]) Set(s string) error

func (*EnumStringValue[E]) String added in v0.16.0

func (v *EnumStringValue[E]) String() string

func (*EnumStringValue[E]) Type added in v0.16.0

func (v *EnumStringValue[E]) Type() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL