flag

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 14 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 IdentityPath added in v0.15.0

func IdentityPath(f *pflag.FlagSet, name string, value []map[string]string, usage string) *[]map[string]string

func IdentityPathP added in v0.15.0

func IdentityPathP(f *pflag.FlagSet, name, shorthand string, value []map[string]string, usage string) *[]map[string]string

func IdentityPathVar added in v0.15.0

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

func IdentityPathVarP added in v0.15.0

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

func IdentityPathVarPF added in v0.15.0

func IdentityPathVarPF(f *pflag.FlagSet, p *[]map[string]string, name, shorthand string, value []map[string]string, 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 Path

func Path(f *pflag.FlagSet, name string, value string, usage string) *string

Path defines a filepath flag with specified name, default value, and usage string. The return value is the address of a string variable that stores the value of the flag.

func PathArray

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

PathArray defines a filepath flag with specified name, default value, and usage string. The return value is the address of a []string variable that stores the value of the flag.

func PathArrayP

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

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

func PathArrayVar

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

PathArrayVar defines a filepath flag with specified name, default value, and usage string. The argument p points to a []string variable in which to store the values of the multiple flags.

func PathArrayVarP

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

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

func PathArrayVarPF

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

PathArrayVarPF is like PathArrayVarP, but returns the created flag.

func PathP

func PathP(f *pflag.FlagSet, name, shorthand string, value string, usage string) *string

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

func PathVar

func PathVar(f *pflag.FlagSet, p *string, name string, value string, usage string)

PathVar defines a filepath flag with specified name, default value, and usage string. The argument p points to a string variable in which to store the value of the flag.

func PathVarP

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

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

func PathVarPF

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

PathVarPF is like PathVarP, but returns the created flag.

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 StringColonStringSliceVar

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

StringColonStringSliceVar 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.

func StringColonStringSliceVarP

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

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

func StringColonStringSliceVarPF

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

StringColonStringSliceVarPF is like StringColonStringSliceVarP, but returns the created flag.

func StringColonStringSliceVarPFA

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

StringColonStringSliceVarPFA is like StringColonStringSliceVarPF, but allows to add to a preset map.

func StringToStringSliceVar

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

StringToStringSliceVar 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.

func StringToStringSliceVarP

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

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

func StringToStringSliceVarPF

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

StringToStringSliceVarPF is like StringToStringVarP, but returns the created flag.

func StringToStringSliceVarPFA

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

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

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