flagext

package
v3.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: AGPL-3.0 Imports: 11 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByteSize

type ByteSize uint64

ByteSize is a flag parsing compatibility type for constructing human friendly sizes. It implements flag.Value & flag.Getter.

func (ByteSize) Get

func (bs ByteSize) Get() interface{}

func (ByteSize) MarshalJSON

func (bs ByteSize) MarshalJSON() ([]byte, error)

Use a string representation for consistency

func (ByteSize) MarshalYAML

func (bs ByteSize) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaller. Use a string representation for consistency

func (*ByteSize) Set

func (bs *ByteSize) Set(s string) error

func (ByteSize) String

func (bs ByteSize) String() string

func (*ByteSize) UnmarshalJSON

func (bs *ByteSize) UnmarshalJSON(val []byte) error

UnmarshalJSON implements json.Unmarsal interface to work with JSON.

func (*ByteSize) UnmarshalYAML

func (bs *ByteSize) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML the Unmarshaler interface of the yaml pkg.

func (ByteSize) Val

func (bs ByteSize) Val() int

type CSV added in v3.2.0

type CSV[T ListValue] []T

StringSliceCSV is a slice of strings that is parsed from a comma-separated string It implements flag.Value and yaml Marshalers

func (CSV[T]) Get added in v3.2.0

func (v CSV[T]) Get() []T

String implements flag.Getter

func (CSV[T]) MarshalYAML added in v3.2.0

func (v CSV[T]) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (*CSV[T]) Set added in v3.2.0

func (v *CSV[T]) Set(s string) error

Set implements flag.Value

func (CSV[T]) String added in v3.2.0

func (v CSV[T]) String() string

String implements flag.Value

func (*CSV[T]) UnmarshalYAML added in v3.2.0

func (v *CSV[T]) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

type FlagSetWithSkip

type FlagSetWithSkip struct {
	*flag.FlagSet
	// contains filtered or unexported fields
}

func NewFlagSetWithSkip

func NewFlagSetWithSkip(f *flag.FlagSet, skip []string) *FlagSetWithSkip

func (*FlagSetWithSkip) BoolVar

func (f *FlagSetWithSkip) BoolVar(p *bool, name string, value bool, usage string)

func (*FlagSetWithSkip) DurationVar

func (f *FlagSetWithSkip) DurationVar(p *time.Duration, name string, value time.Duration, usage string)

func (*FlagSetWithSkip) IntVar

func (f *FlagSetWithSkip) IntVar(p *int, name string, value int, usage string)

func (*FlagSetWithSkip) StringVar

func (f *FlagSetWithSkip) StringVar(p *string, name string, value string, usage string)

func (*FlagSetWithSkip) ToFlagSet

func (f *FlagSetWithSkip) ToFlagSet() *flag.FlagSet

func (*FlagSetWithSkip) Var

func (f *FlagSetWithSkip) Var(value flag.Value, name string, usage string)

type LabelSet

type LabelSet struct {
	model.LabelSet `yaml:",inline"`
}

LabelSet is a labelSet that can be used as a flag.

func (LabelSet) MarshalYAML

func (v LabelSet) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaller.

func (*LabelSet) Set

func (v *LabelSet) Set(s string) error

Set implements flag.Value

func (LabelSet) String

func (v LabelSet) String() string

String implements flag.Value Format: a=1,b=2

func (*LabelSet) UnmarshalYAML

func (v *LabelSet) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML the Unmarshaler interface of the yaml pkg.

type ListValue added in v3.2.0

type ListValue interface {
	String() string
	Parse(s string) (any, error)
}

Jump to

Keyboard shortcuts

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