Documentation ¶
Index ¶
- func ToNormalizedStringSlice(value string) ([]string, error)
- type FlagData
- type FlagSet
- func (flagSet *FlagSet) BoolVar(field *bool, long string, defaultValue bool, usage string) *FlagData
- func (flagSet *FlagSet) BoolVarP(field *bool, long, short string, defaultValue bool, usage string) *FlagData
- func (flagSet *FlagSet) IntVar(field *int, long string, defaultValue int, usage string) *FlagData
- func (flagSet *FlagSet) IntVarP(field *int, long, short string, defaultValue int, usage string) *FlagData
- func (flagSet *FlagSet) MergeConfigFile(file string) error
- func (flagSet *FlagSet) NormalizedStringSliceVar(field *NormalizedStringSlice, long string, defaultValue NormalizedStringSlice, ...) *FlagData
- func (flagSet *FlagSet) NormalizedStringSliceVarP(field *NormalizedStringSlice, long, short string, ...) *FlagData
- func (flagSet *FlagSet) Parse() error
- func (flagSet *FlagSet) RuntimeMapVar(field *RuntimeMap, long string, defaultValue []string, usage string) *FlagData
- func (flagSet *FlagSet) RuntimeMapVarP(field *RuntimeMap, long, short string, defaultValue []string, usage string) *FlagData
- func (flagSet *FlagSet) SetDescription(description string)
- func (flagSet *FlagSet) SetGroup(name, description string)
- func (flagSet *FlagSet) StringSliceVar(field *StringSlice, long string, defaultValue StringSlice, usage string) *FlagData
- func (flagSet *FlagSet) StringSliceVarP(field *StringSlice, long, short string, defaultValue StringSlice, usage string) *FlagData
- func (flagSet *FlagSet) StringVar(field *string, long, defaultValue, usage string) *FlagData
- func (flagSet *FlagSet) StringVarEnv(field *string, long, short, defaultValue, envName, usage string) *FlagData
- func (flagSet *FlagSet) StringVarP(field *string, long, short, defaultValue, usage string) *FlagData
- func (flagSet *FlagSet) Var(field flag.Value, long, usage string) *FlagData
- func (flagSet *FlagSet) VarP(field flag.Value, long, short, usage string) *FlagData
- type InsertionOrderedMap
- type NormalizedStringSlice
- type RuntimeMap
- type StringSlice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToNormalizedStringSlice ¶
Types ¶
type FlagData ¶
type FlagData struct {
// contains filtered or unexported fields
}
type FlagSet ¶
type FlagSet struct { Marshal bool // OtherOptionsGroupName is the name for all flags not in a group OtherOptionsGroupName string // contains filtered or unexported fields }
FlagSet is a list of flags for an application
func NewFlagSet ¶
func NewFlagSet() *FlagSet
NewFlagSet creates a new flagSet structure for the application
func (*FlagSet) BoolVar ¶
func (flagSet *FlagSet) BoolVar(field *bool, long string, defaultValue bool, usage string) *FlagData
BoolVar adds a bool flag with a longname
func (*FlagSet) BoolVarP ¶
func (flagSet *FlagSet) BoolVarP(field *bool, long, short string, defaultValue bool, usage string) *FlagData
BoolVarP adds a bool flag with a shortname and longname
func (*FlagSet) IntVarP ¶
func (flagSet *FlagSet) IntVarP(field *int, long, short string, defaultValue int, usage string) *FlagData
IntVarP adds a int flag with a shortname and longname
func (*FlagSet) MergeConfigFile ¶
MergeConfigFile reads a config file to merge values from.
func (*FlagSet) NormalizedStringSliceVar ¶
func (flagSet *FlagSet) NormalizedStringSliceVar(field *NormalizedStringSlice, long string, defaultValue NormalizedStringSlice, usage string) *FlagData
NormalizedStringSliceVar adds a path slice flag with a long name It supports comma separated values, that are normalized (lower-cased, stripped of any leading and trailing whitespaces and quotes)
func (*FlagSet) NormalizedStringSliceVarP ¶
func (flagSet *FlagSet) NormalizedStringSliceVarP(field *NormalizedStringSlice, long, short string, defaultValue NormalizedStringSlice, usage string) *FlagData
NormalizedStringSliceVarP adds a path slice flag with a shortname and longname. It supports comma separated values, that are normalized (lower-cased, stripped of any leading and trailing whitespaces and quotes)
func (*FlagSet) RuntimeMapVar ¶
func (flagSet *FlagSet) RuntimeMapVar(field *RuntimeMap, long string, defaultValue []string, usage string) *FlagData
RuntimeMapVarP adds a runtime only map flag with a longname
func (*FlagSet) RuntimeMapVarP ¶
func (flagSet *FlagSet) RuntimeMapVarP(field *RuntimeMap, long, short string, defaultValue []string, usage string) *FlagData
RuntimeMapVarP adds a runtime only map flag with a shortname and longname
func (*FlagSet) SetDescription ¶
SetDescription sets the description field for a flagSet to a value.
func (*FlagSet) SetGroup ¶
SetGroup sets a group with name and description for the command line options
The order in which groups are passed is also kept as is, similar to flags.
func (*FlagSet) StringSliceVar ¶
func (flagSet *FlagSet) StringSliceVar(field *StringSlice, long string, defaultValue StringSlice, usage string) *FlagData
StringSliceVar adds a string slice flag with a longname Supports ONE value at a time. Adding multiple values require repeating the argument (-flag value1 -flag value2) No value normalization is happening.
func (*FlagSet) StringSliceVarP ¶
func (flagSet *FlagSet) StringSliceVarP(field *StringSlice, long, short string, defaultValue StringSlice, usage string) *FlagData
StringSliceVarP adds a string slice flag with a shortname and longname Supports ONE value at a time. Adding multiple values require repeating the argument (-flag value1 -flag value2) No value normalization is happening.
func (*FlagSet) StringVarEnv ¶
func (flagSet *FlagSet) StringVarEnv(field *string, long, short, defaultValue, envName, usage string) *FlagData
StringVarEnv adds a string flag with a shortname and longname with a default value read from env variable with a default value fallback
func (*FlagSet) StringVarP ¶
func (flagSet *FlagSet) StringVarP(field *string, long, short, defaultValue, usage string) *FlagData
StringVarP adds a string flag with a shortname and longname
type InsertionOrderedMap ¶
type InsertionOrderedMap struct {
// contains filtered or unexported fields
}
func (*InsertionOrderedMap) Set ¶
func (insertionOrderedMap *InsertionOrderedMap) Set(key string, value *FlagData)
type NormalizedStringSlice ¶
type NormalizedStringSlice []string
NormalizedStringSlice is a slice of strings
func (*NormalizedStringSlice) Set ¶
func (normalizedStringSlice *NormalizedStringSlice) Set(value string) error
Set appends a value to the string slice.
func (NormalizedStringSlice) String ¶
func (normalizedStringSlice NormalizedStringSlice) String() string
type RuntimeMap ¶
type RuntimeMap struct {
// contains filtered or unexported fields
}
RuntimeMap is a runtime only map of interfaces
func (*RuntimeMap) AsMap ¶
func (runtimeMap *RuntimeMap) AsMap() map[string]interface{}
AsMap returns the internal map as reference - changes are allowed
func (*RuntimeMap) IsEmpty ¶
func (runtimeMap *RuntimeMap) IsEmpty() bool
IsEmpty specifies if the underlying map is empty
func (*RuntimeMap) Set ¶
func (runtimeMap *RuntimeMap) Set(value string) error
Set inserts a value to the map. Format: key=value
func (RuntimeMap) String ¶
func (runtimeMap RuntimeMap) String() string
type StringSlice ¶
type StringSlice []string
StringSlice is a slice of strings
func (*StringSlice) Set ¶
func (stringSlice *StringSlice) Set(value string) error
Set appends a value to the string slice.
func (StringSlice) String ¶
func (stringSlice StringSlice) String() string