flags

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: May 22, 2019 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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 Merge

func Merge(dst, src *flag.FlagSet)

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.

func Usage

func Usage(txt string, flags *flag.FlagSet) string

func Visit

func Visit(path string, visitor VisitFn) error

Visit will call the visitor function on the path if it's a file, or for each file in the path if it's a directory. Directories will not be recursed into, and files in the directory will be visited in alphabetical order.

Types

type AppendSliceValue

type AppendSliceValue []string

AppendSliceValue implements the flag.Value interface and allows multiple calls to the same variable to append a list.

func (*AppendSliceValue) Set

func (s *AppendSliceValue) Set(value string) error

func (*AppendSliceValue) String

func (s *AppendSliceValue) String() string

type BoolValue

type BoolValue struct {
	// contains filtered or unexported fields
}

BoolValue provides a flag value that's aware if it has been set.

func (*BoolValue) IsBoolFlag

func (b *BoolValue) IsBoolFlag() bool

IsBoolFlag is an optional method of the flag.Value interface which marks this value as boolean when the return value is true. See flag.Value for details.

func (*BoolValue) Merge

func (b *BoolValue) Merge(onto *bool)

Merge will overlay this value if it has been set.

func (*BoolValue) Set

func (b *BoolValue) Set(v string) error

Set implements the flag.Value interface.

func (*BoolValue) String

func (b *BoolValue) String() string

String implements the flag.Value interface.

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.

func (*DurationValue) Set

func (d *DurationValue) Set(v string) error

Set implements the flag.Value interface.

func (*DurationValue) String

func (d *DurationValue) String() string

String implements the flag.Value interface.

type FlagMapValue

type FlagMapValue map[string]string

FlagMapValue is a flag implementation used to provide key=value semantics multiple times.

func (*FlagMapValue) Set

func (h *FlagMapValue) Set(value string) error

func (*FlagMapValue) String

func (h *FlagMapValue) String() string

type HTTPFlags

type HTTPFlags struct {
	// contains filtered or unexported fields
}

func (*HTTPFlags) APIClient

func (f *HTTPFlags) APIClient() (*api.Client, error)

func (*HTTPFlags) Addr

func (f *HTTPFlags) Addr() string

func (*HTTPFlags) ClientFlags

func (f *HTTPFlags) ClientFlags() *flag.FlagSet

func (*HTTPFlags) Datacenter

func (f *HTTPFlags) Datacenter() string

func (*HTTPFlags) MergeOntoConfig added in v1.0.4

func (f *HTTPFlags) MergeOntoConfig(c *api.Config)

func (*HTTPFlags) ServerFlags

func (f *HTTPFlags) ServerFlags() *flag.FlagSet

func (*HTTPFlags) SetToken added in v1.2.0

func (f *HTTPFlags) SetToken(v string) error

func (*HTTPFlags) Stale

func (f *HTTPFlags) Stale() bool

func (*HTTPFlags) Token

func (f *HTTPFlags) Token() string

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.

func (*StringValue) Set

func (s *StringValue) Set(v string) error

Set implements the flag.Value interface.

func (*StringValue) String

func (s *StringValue) String() string

String implements the flag.Value interface.

type UintValue

type UintValue struct {
	// contains filtered or unexported fields
}

UintValue provides a flag value that's aware if it has been set.

func (*UintValue) Merge

func (u *UintValue) Merge(onto *uint)

Merge will overlay this value if it has been set.

func (*UintValue) Set

func (u *UintValue) Set(v string) error

Set implements the flag.Value interface.

func (*UintValue) String

func (u *UintValue) String() string

String implements the flag.Value interface.

type Usager

type Usager struct {
	Usage string
	Flags *flag.FlagSet
}

func (*Usager) String

func (u *Usager) String() string

type VisitFn

type VisitFn func(path string) error

VisitFn is a callback that gets a chance to visit each file found during a traversal with visit().

Jump to

Keyboard shortcuts

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