Documentation ¶
Index ¶
- Variables
- func BoolToBoolValueFunc() mapstructure.DecodeHookFunc
- func Float64ToUintValueFunc() mapstructure.DecodeHookFunc
- func StringToDurationValueFunc() mapstructure.DecodeHookFunc
- func StringToStringValueFunc() mapstructure.DecodeHookFunc
- func Visit(path string, visitor VisitFn) error
- type BoolValue
- type Command
- func (c *Command) HTTPAddr() string
- func (c *Command) HTTPClient() (*api.Client, error)
- func (c *Command) HTTPDatacenter() string
- func (c *Command) HTTPStale() bool
- func (c *Command) HTTPToken() string
- func (c *Command) Help() string
- func (c *Command) HideFlags(flags ...string)
- func (c *Command) NewFlagSet(command cli.Command) *flag.FlagSet
- func (c *Command) Parse(args []string) error
- type DurationValue
- type FlagSetFlags
- type StringValue
- type UintValue
- type VisitFn
Constants ¶
This section is empty.
Variables ¶
var ConfigDecodeHook = mapstructure.ComposeDecodeHookFunc( BoolToBoolValueFunc(), StringToDurationValueFunc(), StringToStringValueFunc(), Float64ToUintValueFunc(), )
configDecodeHook should be passed to mapstructure in order to decode into the *Value objects here.
Functions ¶
func BoolToBoolValueFunc ¶
func BoolToBoolValueFunc() mapstructure.DecodeHookFunc
BoolToBoolValueFunc is a mapstructure hook that looks for an incoming bool mapped to a BoolValue and does the translation.
func Float64ToUintValueFunc ¶
func Float64ToUintValueFunc() mapstructure.DecodeHookFunc
Float64ToUintValueFunc is a mapstructure hook that looks for an incoming float64 mapped to a UintValue and does the translation.
func StringToDurationValueFunc ¶
func StringToDurationValueFunc() mapstructure.DecodeHookFunc
StringToDurationValueFunc is a mapstructure hook that looks for an incoming string mapped to a DurationValue and does the translation.
func StringToStringValueFunc ¶
func StringToStringValueFunc() mapstructure.DecodeHookFunc
StringToStringValueFunc is a mapstructure hook that looks for an incoming string mapped to a StringValue and does the translation.
Types ¶
type BoolValue ¶
type BoolValue struct {
// contains filtered or unexported fields
}
BoolValue provides a flag value that's aware if it has been set.
type Command ¶
type Command struct { Ui cli.Ui Flags FlagSetFlags // contains filtered or unexported fields }
func (*Command) HTTPClient ¶
HTTPClient returns a client with the parsed flags. It panics if the command does not accept HTTP flags or if the flags have not been parsed.
func (*Command) HTTPDatacenter ¶
func (*Command) HideFlags ¶
HideFlags is used to set hidden flags that will not be shown in help text
func (*Command) NewFlagSet ¶
NewFlagSet creates a new flag set for the given command. It automatically generates help output and adds the appropriate API flags.
type DurationValue ¶
type DurationValue struct {
// contains filtered or unexported fields
}
DurationValue provides a flag value that's aware if it has been set.
func (*DurationValue) Merge ¶
func (d *DurationValue) Merge(onto *time.Duration)
Merge will overlay this value if it has been set.
type FlagSetFlags ¶
type FlagSetFlags uint
FlagSetFlags is an enum to define what flags are present in the default FlagSet returned.
const ( FlagSetNone FlagSetFlags = 1 << iota FlagSetClientHTTP FlagSetFlags = 1 << iota FlagSetServerHTTP FlagSetFlags = 1 << iota FlagSetHTTP = FlagSetClientHTTP | FlagSetServerHTTP )
type StringValue ¶
type StringValue struct {
// contains filtered or unexported fields
}
StringValue provides a flag value that's aware if it has been set.
func (*StringValue) Merge ¶
func (s *StringValue) Merge(onto *string)
Merge will overlay this value if it has been set.