package flags
import "github.com/coreos/etcd/pkg/flags"
Package flags implements command-line flag parsing.
Index ¶
- func FlagToEnv(prefix, name string) string
- func IsSet(fs *flag.FlagSet, name string) bool
- func SetFlagsFromEnv(prefix string, fs *flag.FlagSet) error
- func SetPflagsFromEnv(prefix string, fs *pflag.FlagSet) error
- func URLsFromFlag(fs *flag.FlagSet, urlsFlagName string) []url.URL
- type DeprecatedFlag
- type IgnoredFlag
- func (f *IgnoredFlag) IsBoolFlag() bool
- func (f *IgnoredFlag) Set(s string) error
- func (f *IgnoredFlag) String() string
- type StringsFlag
- func NewStringsFlag(valids ...string) *StringsFlag
- func (ss *StringsFlag) Set(s string) error
- func (ss *StringsFlag) String() string
- type URLsValue
Functions ¶
func FlagToEnv ¶
FlagToEnv converts flag string to upper-case environment variable key string.
func IsSet ¶
func SetFlagsFromEnv ¶
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 ¶
SetPflagsFromEnv is similar to SetFlagsFromEnv. However, the accepted flagset type is pflag.FlagSet and it does not do any logging.
func URLsFromFlag ¶
URLsFromFlag returns a slices from url got from the flag.
Types ¶
type DeprecatedFlag ¶
type DeprecatedFlag struct { Name string }
DeprecatedFlag encapsulates a flag that may have been previously valid but is now deprecated. If a DeprecatedFlag is set, an error occurs.
func (*DeprecatedFlag) Set ¶
func (f *DeprecatedFlag) Set(_ string) error
func (*DeprecatedFlag) String ¶
func (f *DeprecatedFlag) String() string
type IgnoredFlag ¶
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 ¶
func (f *IgnoredFlag) IsBoolFlag() bool
IsBoolFlag is defined to allow the flag to be defined without an argument
func (*IgnoredFlag) Set ¶
func (f *IgnoredFlag) Set(s string) error
func (*IgnoredFlag) String ¶
func (f *IgnoredFlag) String() string
type StringsFlag ¶
type StringsFlag struct { Values []string // contains filtered or unexported fields }
StringsFlag implements the flag.Value interface.
func NewStringsFlag ¶
func NewStringsFlag(valids ...string) *StringsFlag
NewStringsFlag creates a new string flag for which any one of the given strings is a valid value, and any other value is an error.
func (*StringsFlag) Set ¶
func (ss *StringsFlag) Set(s string) error
Set verifies the argument to be a valid member of the allowed values before setting the underlying flag value.
func (*StringsFlag) String ¶
func (ss *StringsFlag) String() string
String returns the set value (if any) of the StringsFlag
type URLsValue ¶
func NewURLsValue ¶
func (*URLsValue) Set ¶
Set parses a command line set of URLs formatted like: http://127.0.0.1:2380,http://10.1.1.2:80
func (*URLsValue) String ¶
Source Files ¶
- Version
- v3.2.5+incompatible
- Published
- Aug 4, 2017
- Platform
- js/wasm
- Imports
- 9 packages
- Last checked
- 6 seconds ago –
Tools for package owners.