Documentation ¶
Index ¶
Constants ¶
const ( DefaultDescTag = "desc" DefaultFlagTag = "flag" DefaultEnvTag = "env" DefaultFlagDivider = "-" DefaultEnvDivider = "_" DefaultFlatten = true )
Variables ¶
var ErrNotPointerToStruct = errors.New("object must be a pointer to struct or interface")
ErrNotPointerToStruct indicates that a provided data container is not a pointer to a struct. Only pointers to structs are valid data containers for options.
var ErrScan = errors.New("scan error")
ErrScan indicates an error in scanning struct fields.
Functions ¶
Types ¶
type FlagFunc ¶
FlagFunc is a generic function that can be applied to each value that will end up being a flags *Flag, so that users can perform more arbitrary operations on each, such as checking for completer implementations, bind to viper configurations, etc.
type Handler ¶
Handler is a generic handler used for scanning both commands and group structs alike.
type Opts ¶
type ValidateFunc ¶
type ValidateFunc func(val string, field reflect.StructField, cfg interface{}) error
ValidateFunc describes a validation func, that takes string val for flag from command line, field that's associated with this flag in structure cfg. Also works for positional arguments. Should return error if validation fails.