base

package
Version: v0.8.3 Latest Latest
Warning

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

Go to latest
Published: May 12, 2017 License: MPL-2.0 Imports: 16 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 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 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 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 Command

type Command struct {
	UI    cli.Ui
	Flags FlagSetFlags
	// contains filtered or unexported fields
}

func (*Command) HTTPAddr

func (c *Command) HTTPAddr() string

func (*Command) HTTPClient

func (c *Command) HTTPClient() (*api.Client, error)

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 (c *Command) HTTPDatacenter() string

func (*Command) HTTPStale

func (c *Command) HTTPStale() bool

func (*Command) HTTPToken

func (c *Command) HTTPToken() string

func (*Command) Help

func (c *Command) Help() string

Help returns the help for this flagSet.

func (*Command) HideFlags

func (c *Command) HideFlags(flags ...string)

HideFlags is used to set hidden flags that will not be shown in help text

func (*Command) NewFlagSet

func (c *Command) NewFlagSet(command cli.Command) *flag.FlagSet

NewFlagSet creates a new flag set for the given command. It automatically generates help output and adds the appropriate API flags.

func (*Command) Parse

func (c *Command) Parse(args []string) error

Parse is used to parse the underlying flag set.

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 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.

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 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