option

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bool

type Bool struct {
	String
}

func NewBoolOption

func NewBoolOption(val *bool) *Bool

func (*Bool) AddFlag

func (option *Bool) AddFlag(name string, usage string) *pflag.Flag

func (*Bool) AddFlagShort

func (option *Bool) AddFlagShort(name string, short string, usage string) *pflag.Flag

func (*Bool) ValueOr

func (option *Bool) ValueOr(generator BoolGenerator) string

type BoolGenerator

type BoolGenerator func(flag *pflag.Flag) bool

type Count

type Count struct {
	String
}

func NewCountOption

func NewCountOption(val *int) *Count

func (*Count) AddFlag

func (option *Count) AddFlag(name string, usage string) *pflag.Flag

func (*Count) AddFlagShort

func (option *Count) AddFlagShort(name string, short string, usage string) *pflag.Flag

func (*Count) ValueOr

func (option *Count) ValueOr(generator CountGenerator) string

type CountGenerator

type CountGenerator func(flag *pflag.Flag) int

type Duration

type Duration struct {
	String
}

func NewDurationOption

func NewDurationOption(val *time.Duration) *Duration

func (*Duration) ValueOr

func (option *Duration) ValueOr(generator DurationGenerator) string

type DurationGenerator

type DurationGenerator func(flag *pflag.Flag) time.Duration

type Group

type Group struct {
	// contains filtered or unexported fields
}

func (*Group) AddFlag

func (group *Group) AddFlag(flag *pflag.Flag)

func (*Group) GetFlag

func (group *Group) GetFlag(name string) *pflag.Flag

func (*Group) GetFlags

func (group *Group) GetFlags() []*pflag.Flag

func (*Group) GetMainFlag

func (group *Group) GetMainFlag() *pflag.Flag

func (*Group) IsChanged

func (group *Group) IsChanged() bool

type String

type String struct {
	Group
	// contains filtered or unexported fields
}

func NewStringOption

func NewStringOption(val *string) *String

func NewStringValueOption

func NewStringValueOption(value Value) *String

func (*String) AddFlag

func (option *String) AddFlag(name string, usage string, flagTypes ...util.BoolFlagType) *pflag.Flag

func (*String) AddFlagShort

func (option *String) AddFlagShort(name string, short string, usage string) *pflag.Flag

func (*String) AddFlagWithExtraHelp added in v0.14.1

func (option *String) AddFlagWithExtraHelp(name string, usage string, help string, flagTypes ...util.BoolFlagType) *pflag.Flag

func (*String) GetFlag added in v0.14.1

func (option *String) GetFlag(name string, flagTypes ...util.BoolFlagType) *pflag.Flag

func (*String) GetRequiredFlag added in v0.14.1

func (option *String) GetRequiredFlag(name string) *pflag.Flag

func (*String) ValueOr

func (option *String) ValueOr(generator StringGenerator) string

@review needs an error variant

func (*String) Var

func (option *String) Var() *Value

type StringGenerator

type StringGenerator func(flag *pflag.Flag) string

type Validator

type Validator func(string, pflag.Value) error

type Value

type Value struct {
	Validator Validator
	// contains filtered or unexported fields
}

func (Value) Set

func (v Value) Set(data string) error

func (Value) String

func (v Value) String() string

func (Value) Type

func (v Value) Type() string

Jump to

Keyboard shortcuts

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