base - ActiveState ActiveGo 1.8
...

Package base

import "github.com/hashicorp/consul/command/base"
Overview
Index

Overview ▾

Variables

ConfigDecodeHook should be passed to mapstructure in order to decode into the *Value objects here.

var ConfigDecodeHook = mapstructure.ComposeDecodeHookFunc(
    BoolToBoolValueFunc(),
    StringToDurationValueFunc(),
    StringToStringValueFunc(),
    Float64ToUintValueFunc(),
)

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.

type BoolValue

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

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

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

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

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

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

FlagSetFlags is an enum to define what flags are present in the default FlagSet returned.

type FlagSetFlags uint
const (
    FlagSetNone       FlagSetFlags = 1 << iota
    FlagSetClientHTTP FlagSetFlags = 1 << iota
    FlagSetServerHTTP FlagSetFlags = 1 << iota

    FlagSetHTTP = FlagSetClientHTTP | FlagSetServerHTTP
)

type StringValue

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

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

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

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

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

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

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

type VisitFn func(path string) error