flagutil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LowerValue

func LowerValue(name string, allowed []string, defaultValue string) pflag.Value

LowerValue returns a pflag.Value interface with that will only accept values from a given list, but before checking the allowed list it will normalized values to lower-case.

func MustBool

func MustBool(flagSet *pflag.FlagSet, name string) bool

MustBool returns the bool value of a flag with the given name, it will panic if the flag does not exists or is not the desired type.

func MustInt

func MustInt(flagSet *pflag.FlagSet, name string) int

MustInt returns the int value of a flag with the given name, it will panic if the flag does not exists or is not the desired type.

func MustString

func MustString(flagSet *pflag.FlagSet, name string) string

MustString returns the string value of a flag with the given name, it will panic if the flag does not exists or is not the desired type.

func NormalizedValue

func NormalizedValue(name string, allowed []string, defaultValue string) pflag.Value

NormalizedValue returns a pflag.Value interface with that will only accept values from a given list, but before checking the allowed list it will normalized values to upper-case and remove any dash or hyphens.

func UpperValue

func UpperValue(name string, allowed []string, defaultValue string) pflag.Value

UpperValue returns a pflag.Value interface with that will only accept values from a given list, but before checking the allowed list it will normalized values to upper-case.

func Value

func Value(name string, allowed []string, defaultValue string) pflag.Value

Value returns a pflag.Value interface with that will only accept values from a given list.

Types

This section is empty.

Jump to

Keyboard shortcuts

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