Documentation ¶
Index ¶
- type BoolValue
- type FlagSet
- func (fs *FlagSet) Bool(name, usage string, val bool, r ...ResolverFunc) *bool
- func (fs *FlagSet) Float64(name, usage string, val float64, r ...ResolverFunc) *float64
- func (fs *FlagSet) Int(name, usage string, val int, r ...ResolverFunc) *int
- func (fs *FlagSet) Int64(name, usage string, val int64, r ...ResolverFunc) *int64
- func (fs *FlagSet) Parse(args []string, opts ...FlagSetOption)
- func (fs *FlagSet) Set(i int, v interface{}, t interface{}) error
- func (fs *FlagSet) String(name, usage string, val string, r ...ResolverFunc) *string
- func (fs *FlagSet) Uint(name, usage string, val uint, r ...ResolverFunc) *uint
- func (fs *FlagSet) Uint64(name, usage string, val uint64, r ...ResolverFunc) *uint64
- type FlagSetOption
- type Float64Value
- type Int64Value
- type IntValue
- type ResolverFunc
- type StringValue
- type Uint64Value
- type UintValue
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FlagSet ¶
type FlagSet struct { Values []interface{} Config map[string]interface{} // contains filtered or unexported fields }
FlagSet represents flags container.
func (*FlagSet) Bool ¶
func (fs *FlagSet) Bool(name, usage string, val bool, r ...ResolverFunc) *bool
Bool creates new Bool flag. Accepts a list of additional resolvers that are evaluated in sequence and the first one to yield a valid value is chosen. If no resolver yileds a valid value the default flag value is used. If flag is provided as a cli arg it will take precedence over all resolvers and the default value.
func (*FlagSet) Float64 ¶
func (fs *FlagSet) Float64(name, usage string, val float64, r ...ResolverFunc) *float64
Float64 creates new Float64 flag. Accepts a list of additional resolvers that are evaluated in sequence and the first one to yield a valid value is chosen. If no resolver yileds a valid value the default flag value is used. If flag is provided as a cli arg it will take precedence over all resolvers and the default value.
func (*FlagSet) Int ¶
func (fs *FlagSet) Int(name, usage string, val int, r ...ResolverFunc) *int
Int creates new Int flag. Accepts a list of additional resolvers that are evaluated in sequence and the first one to yield a valid value is chosen. If no resolver yileds a valid value the default flag value is used. If flag is provided as a cli arg it will take precedence over all resolvers and the default value.
func (*FlagSet) Int64 ¶
func (fs *FlagSet) Int64(name, usage string, val int64, r ...ResolverFunc) *int64
Int64 creates new Int64 flag. Accepts a list of additional resolvers that are evaluated in sequence and the first one to yield a valid value is chosen. If no resolver yileds a valid value the default flag value is used. If flag is provided as a cli arg it will take precedence over all resolvers and the default value.
func (*FlagSet) Parse ¶
func (fs *FlagSet) Parse(args []string, opts ...FlagSetOption)
Parse parses command line flags and runs all additional resolvers for each flag in sequence. If command line flag is set it takes precedence over all other resolvers which are skipped in that case.
func (*FlagSet) String ¶
func (fs *FlagSet) String(name, usage string, val string, r ...ResolverFunc) *string
String creates new String flag. Accepts a list of additional resolvers that are evaluated in sequence and the first one to yield a valid value is chosen. If no resolver yileds a valid value the default flag value is used. If flag is provided as a cli arg it will take precedence over all resolvers and the default value.
func (*FlagSet) Uint ¶
func (fs *FlagSet) Uint(name, usage string, val uint, r ...ResolverFunc) *uint
Uint creates new Uint flag. Accepts a list of additional resolvers that are evaluated in sequence and the first one to yield a valid value is chosen. If no resolver yileds a valid value the default flag value is used. If flag is provided as a cli arg it will take precedence over all resolvers and the default value.
func (*FlagSet) Uint64 ¶
func (fs *FlagSet) Uint64(name, usage string, val uint64, r ...ResolverFunc) *uint64
Uint64 creates new Uint64 flag. Accepts a list of additional resolvers that are evaluated in sequence and the first one to yield a valid value is chosen. If no resolver yileds a valid value the default flag value is used. If flag is provided as a cli arg it will take precedence over all resolvers and the default value.
type FlagSetOption ¶
type FlagSetOption func(*FlagSet)
FlagSetOption func mainly used for extending FlagSet configuration for different types of resolvers.
type Float64Value ¶
Float64Value flag type.
func (*Float64Value) Set ¶
func (val *Float64Value) Set(v interface{}) error
Set converts and sets a value
type Int64Value ¶
Int64Value flag type.
func (*Int64Value) Set ¶
func (val *Int64Value) Set(v interface{}) error
Set converts and sets a value
type ResolverFunc ¶
ResolverFunc represents a resolver for a primitive flag type. Used for implementing additional config mechanisms (see env/ and json/).
type StringValue ¶
StringValue flag type.
func (*StringValue) Set ¶
func (val *StringValue) Set(v interface{}) error
Set converts and sets a value
type Uint64Value ¶
Uint64Value flag type.
func (*Uint64Value) Set ¶
func (val *Uint64Value) Set(v interface{}) error
Set converts and sets a value