etcd: go.etcd.io/etcd/pkg/flags Index | Files

package flags

import "go.etcd.io/etcd/pkg/flags"

Package flags implements command-line flag parsing.

Index

Package Files

flag.go ignored.go selective_string.go strings.go unique_strings.go unique_urls.go urls.go

func FlagToEnv Uses

func FlagToEnv(prefix, name string) string

FlagToEnv converts flag string to upper-case environment variable key string.

func IsSet Uses

func IsSet(fs *flag.FlagSet, name string) bool

func SetFlagsFromEnv Uses

func SetFlagsFromEnv(prefix string, fs *flag.FlagSet) error

SetFlagsFromEnv parses all registered flags in the given flagset, and if they are not already set it attempts to set their values from environment variables. Environment variables take the name of the flag but are UPPERCASE, have the given prefix and any dashes are replaced by underscores - for example: some-flag => ETCD_SOME_FLAG

func SetPflagsFromEnv Uses

func SetPflagsFromEnv(prefix string, fs *pflag.FlagSet) error

SetPflagsFromEnv is similar to SetFlagsFromEnv. However, the accepted flagset type is pflag.FlagSet and it does not do any logging.

func StringsFromFlag Uses

func StringsFromFlag(fs *flag.FlagSet, flagName string) []string

StringsFromFlag returns a string slice from the flag.

func URLsFromFlag Uses

func URLsFromFlag(fs *flag.FlagSet, urlsFlagName string) []url.URL

URLsFromFlag returns a slices from url got from the flag.

func UniqueStringsFromFlag Uses

func UniqueStringsFromFlag(fs *flag.FlagSet, flagName string) []string

UniqueStringsFromFlag returns a string slice from the flag.

func UniqueStringsMapFromFlag Uses

func UniqueStringsMapFromFlag(fs *flag.FlagSet, flagName string) map[string]struct{}

UniqueStringsMapFromFlag returns a map of strings from the flag.

func UniqueURLsFromFlag Uses

func UniqueURLsFromFlag(fs *flag.FlagSet, urlsFlagName string) []url.URL

UniqueURLsFromFlag returns a slice from urls got from the flag.

func UniqueURLsMapFromFlag Uses

func UniqueURLsMapFromFlag(fs *flag.FlagSet, urlsFlagName string) map[string]struct{}

UniqueURLsMapFromFlag returns a map from url strings got from the flag.

type IgnoredFlag Uses

type IgnoredFlag struct {
    Name string
}

IgnoredFlag encapsulates a flag that may have been previously valid but is now ignored. If an IgnoredFlag is set, a warning is printed and operation continues.

func (*IgnoredFlag) IsBoolFlag Uses

func (f *IgnoredFlag) IsBoolFlag() bool

IsBoolFlag is defined to allow the flag to be defined without an argument

func (*IgnoredFlag) Set Uses

func (f *IgnoredFlag) Set(s string) error

func (*IgnoredFlag) String Uses

func (f *IgnoredFlag) String() string

type SelectiveStringValue Uses

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

SelectiveStringValue implements the flag.Value interface.

func NewSelectiveStringValue Uses

func NewSelectiveStringValue(valids ...string) *SelectiveStringValue

NewSelectiveStringValue creates a new string flag for which any one of the given strings is a valid value, and any other value is an error.

valids[0] will be default value. Caller must be sure len(valids) != 0 or it will panic.

func (*SelectiveStringValue) Set Uses

func (ss *SelectiveStringValue) Set(s string) error

Set verifies the argument to be a valid member of the allowed values before setting the underlying flag value.

func (*SelectiveStringValue) String Uses

func (ss *SelectiveStringValue) String() string

String returns the set value (if any) of the SelectiveStringValue

func (*SelectiveStringValue) Valids Uses

func (ss *SelectiveStringValue) Valids() []string

Valids returns the list of valid strings.

type SelectiveStringsValue Uses

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

SelectiveStringsValue implements the flag.Value interface.

func NewSelectiveStringsValue Uses

func NewSelectiveStringsValue(valids ...string) *SelectiveStringsValue

NewSelectiveStringsValue creates a new string slice flag for which any one of the given strings is a valid value, and any other value is an error.

func (*SelectiveStringsValue) Set Uses

func (ss *SelectiveStringsValue) Set(s string) error

Set verifies the argument to be a valid member of the allowed values before setting the underlying flag value.

func (*SelectiveStringsValue) String Uses

func (ss *SelectiveStringsValue) String() string

String returns the set value (if any) of the SelectiveStringsValue.

func (*SelectiveStringsValue) Valids Uses

func (ss *SelectiveStringsValue) Valids() []string

Valids returns the list of valid strings.

type StringsValue Uses

type StringsValue sort.StringSlice

StringsValue wraps "sort.StringSlice".

func NewStringsValue Uses

func NewStringsValue(s string) (ss *StringsValue)

NewStringsValue implements string slice as "flag.Value" interface. Given value is to be separated by comma.

func (*StringsValue) Set Uses

func (ss *StringsValue) Set(s string) error

Set parses a command line set of strings, separated by comma. Implements "flag.Value" interface.

func (*StringsValue) String Uses

func (ss *StringsValue) String() string

String implements "flag.Value" interface.

type URLsValue Uses

type URLsValue types.URLs

URLsValue wraps "types.URLs".

func NewURLsValue Uses

func NewURLsValue(s string) *URLsValue

NewURLsValue implements "url.URL" slice as flag.Value interface. Given value is to be separated by comma.

func (*URLsValue) Set Uses

func (us *URLsValue) Set(s string) error

Set parses a command line set of URLs formatted like: http://127.0.0.1:2380,http://10.1.1.2:80 Implements "flag.Value" interface.

func (*URLsValue) String Uses

func (us *URLsValue) String() string

String implements "flag.Value" interface.

type UniqueStringsValue Uses

type UniqueStringsValue struct {
    Values map[string]struct{}
}

UniqueStringsValue wraps a list of unique strings. The values are set in order.

func NewUniqueStringsValue Uses

func NewUniqueStringsValue(s string) (us *UniqueStringsValue)

NewUniqueStringsValue implements string slice as "flag.Value" interface. Given value is to be separated by comma. The values are set in order.

func (*UniqueStringsValue) Set Uses

func (us *UniqueStringsValue) Set(s string) error

Set parses a command line set of strings, separated by comma. Implements "flag.Value" interface. The values are set in order.

func (*UniqueStringsValue) String Uses

func (us *UniqueStringsValue) String() string

String implements "flag.Value" interface.

type UniqueURLs Uses

type UniqueURLs struct {
    Values map[string]struct{}

    Allowed map[string]struct{}
    // contains filtered or unexported fields
}

UniqueURLs contains unique URLs with non-URL exceptions.

func NewUniqueURLsWithExceptions Uses

func NewUniqueURLsWithExceptions(s string, exceptions ...string) *UniqueURLs

NewUniqueURLsWithExceptions implements "url.URL" slice as flag.Value interface. Given value is to be separated by comma.

func (*UniqueURLs) Set Uses

func (us *UniqueURLs) Set(s string) error

Set parses a command line set of URLs formatted like: http://127.0.0.1:2380,http://10.1.1.2:80 Implements "flag.Value" interface.

func (*UniqueURLs) String Uses

func (us *UniqueURLs) String() string

String implements "flag.Value" interface.

Package flags imports 10 packages (graph) and is imported by 24 packages. Updated 2019-02-19. Refresh now. Tools for package owners.