flag

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolVarPF

func BoolVarPF(f *pflag.FlagSet, p *bool, name, shorthand string, value bool, usage string) *pflag.Flag

BoolVarPF is like BoolVarP, but returns the created flag.

func BytesBase64Var

func BytesBase64Var(f *pflag.FlagSet, name string, value []byte, usage string) *[]byte

BytesBase64Var defines an []byte flag with specified name, default value, and usage string. The return value is the address of an []byte variable that stores the value of the flag.

func BytesBase64VarP

func BytesBase64VarP(f *pflag.FlagSet, p *[]byte, name, shorthand string, value []byte, usage string)

BytesBase64VarP is like BytesBase64Var, but accepts a shorthand letter that can be used after a single dash.

func BytesBase64VarPF

func BytesBase64VarPF(f *pflag.FlagSet, p *[]byte, name, shorthand string, value []byte, usage string) *pflag.Flag

func IntVarPF

func IntVarPF(f *pflag.FlagSet, p *int, name, shorthand string, value int, usage string) *pflag.Flag

IntVarPF is like IntVarP, but returns the created flag.

func LabelledStringVarP

func LabelledStringVarP(flags *pflag.FlagSet, p *LabelledString, name, shorthand string, value LabelledString, usage string)

func LabelledStringVarPF

func LabelledStringVarPF(flags *pflag.FlagSet, p *LabelledString, name, shorthand string, value LabelledString, usage string) *pflag.Flag

func LabelledValueVarP

func LabelledValueVarP(flags *pflag.FlagSet, p *LabelledValue, name, shorthand string, value LabelledValue, usage string)

func LabelledValueVarPF

func LabelledValueVarPF(flags *pflag.FlagSet, p *LabelledValue, name, shorthand string, value LabelledValue, usage string) *pflag.Flag

func NewLabelledStringValue

func NewLabelledStringValue(val LabelledString, p *LabelledString) *labelledStringValue

func Semver

func Semver(f *pflag.FlagSet, name string, value []*semver.Version, usage string) *[]*semver.Version

func SemverConstraints

func SemverConstraints(f *pflag.FlagSet, name string, value []*semver.Constraints, usage string) *[]*semver.Constraints

func SemverConstraintsP

func SemverConstraintsP(f *pflag.FlagSet, name, shorthand string, value []*semver.Constraints, usage string) *[]*semver.Constraints

func SemverConstraintsVar

func SemverConstraintsVar(f *pflag.FlagSet, p *[]*semver.Constraints, name string, value []*semver.Constraints, usage string)

func SemverConstraintsVarP

func SemverConstraintsVarP(f *pflag.FlagSet, p *[]*semver.Constraints, name, shorthand string, value []*semver.Constraints, usage string)

func SemverConstraintsVarPF

func SemverConstraintsVarPF(f *pflag.FlagSet, p *[]*semver.Constraints, name, shorthand string, value []*semver.Constraints, usage string) *pflag.Flag

func SemverP

func SemverP(f *pflag.FlagSet, name, shorthand string, value []*semver.Version, usage string) *[]*semver.Version

func SemverVar

func SemverVar(f *pflag.FlagSet, p *[]*semver.Version, name string, value []*semver.Version, usage string)

func SemverVarP

func SemverVarP(f *pflag.FlagSet, p *[]*semver.Version, name, shorthand string, value []*semver.Version, usage string)

func SemverVarPF

func SemverVarPF(f *pflag.FlagSet, p *[]*semver.Version, name, shorthand string, value []*semver.Version, usage string) *pflag.Flag

func StringArrayVarPF

func StringArrayVarPF(f *pflag.FlagSet, p *[]string, name, shorthand string, value []string, usage string) *pflag.Flag

StringArrayVarPF is like StringArrayVarP, but returns the created flag.

func StringToStringVar

func StringToStringVar[T ~map[string]string](f *pflag.FlagSet, p *T, name string, value map[string]string, usage string)

StringToStringVar defines a string flag with specified name, default value, and usage string. The argument p points to a map[string]string variable in which to store the values of the multiple flags. The value of each argument will not try to be separated by comma.

func StringToStringVarP

func StringToStringVarP[T ~map[string]string](f *pflag.FlagSet, p *T, name, shorthand string, value map[string]string, usage string)

StringToStringVarP is like StringToStringVar, but accepts a shorthand letter that can be used after a single dash.

func StringToStringVarPF

func StringToStringVarPF[T ~map[string]string](f *pflag.FlagSet, p *T, name, shorthand string, value map[string]string, usage string) *pflag.Flag

StringToStringVarPF is like StringToStringVarP, but returns the created flag.

func StringToStringVarPFA

func StringToStringVarPFA[T ~map[string]string](f *pflag.FlagSet, p *T, name, shorthand string, value map[string]string, usage string) *pflag.Flag

StringToStringVarPFA is like StringToStringVarPF, but allows to add to a preset map.

func StringToValue

func StringToValue(f *pflag.FlagSet, name string, value map[string]interface{}, usage string) *map[string]interface{}

func StringToValueP

func StringToValueP(f *pflag.FlagSet, name, shorthand string, value map[string]interface{}, usage string) *map[string]interface{}

func StringToValueVar

func StringToValueVar(f *pflag.FlagSet, p *map[string]interface{}, name string, value map[string]interface{}, usage string)

func StringToValueVarP

func StringToValueVarP(f *pflag.FlagSet, p *map[string]interface{}, name, shorthand string, value map[string]interface{}, usage string)

func StringToValueVarPF

func StringToValueVarPF(f *pflag.FlagSet, p *map[string]interface{}, name, shorthand string, value map[string]interface{}, usage string) *pflag.Flag

func StringVarPF

func StringVarPF(f *pflag.FlagSet, p *string, name, shorthand string, value string, usage string) *pflag.Flag

StringVarPF is like StringVarP, but returns the created flag.

func YAMLVarP

func YAMLVarP[T any](flags *pflag.FlagSet, p *T, name, shorthand string, value T, usage string)

func YAMLVarPF

func YAMLVarPF[T any](flags *pflag.FlagSet, p *T, name, shorthand string, value T, usage string) *pflag.Flag

Types

type LabelledString

type LabelledString struct {
	Name  string
	Value string
}

type LabelledValue

type LabelledValue struct {
	Name  string
	Value interface{}
}

type LabelledValueValue

type LabelledValueValue LabelledValue

func NewLabelledValueValue

func NewLabelledValueValue(val LabelledValue, p *LabelledValue) *LabelledValueValue

func (*LabelledValueValue) Set

func (i *LabelledValueValue) Set(s string) error

func (*LabelledValueValue) String

func (i *LabelledValueValue) String() string

func (*LabelledValueValue) Type

func (i *LabelledValueValue) Type() string

type YAMLValue

type YAMLValue[T any] struct {
	// contains filtered or unexported fields
}

func NewYAMLValue

func NewYAMLValue[T any](val T, p *T) *YAMLValue[T]

func (*YAMLValue[T]) Set

func (i *YAMLValue[T]) Set(s string) error

func (*YAMLValue[T]) String

func (i *YAMLValue[T]) String() string

func (*YAMLValue[T]) Type

func (i *YAMLValue[T]) Type() string

Jump to

Keyboard shortcuts

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