...

Package flag

import "k8s.io/component-base/cli/flag"
Overview
Index

Overview ▾

Index ▾

func DefaultTLSVersion() uint16
func InitFlags()
func InsecureTLSCipherNames() []string
func InsecureTLSCiphers() map[string]uint16
func PreferredTLSCipherNames() []string
func PrintFlags(flags *pflag.FlagSet)
func PrintSections(w io.Writer, fss NamedFlagSets, cols int)
func SetUsageAndHelpFunc(cmd *cobra.Command, fss NamedFlagSets, cols int)
func TLSCipherPossibleValues() []string
func TLSCipherSuites(cipherNames []string) ([]uint16, error)
func TLSPossibleVersions() []string
func TLSVersion(versionName string) (uint16, error)
func WarnWordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName
func WordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName
type ColonSeparatedMultimapStringString
    func NewColonSeparatedMultimapStringString(m *map[string][]string) *ColonSeparatedMultimapStringString
    func (m *ColonSeparatedMultimapStringString) Empty() bool
    func (m *ColonSeparatedMultimapStringString) Set(value string) error
    func (m *ColonSeparatedMultimapStringString) String() string
    func (m *ColonSeparatedMultimapStringString) Type() string
type ConfigurationMap
    func (m *ConfigurationMap) Set(value string) error
    func (m *ConfigurationMap) String() string
    func (*ConfigurationMap) Type() string
type LangleSeparatedMapStringString
    func NewLangleSeparatedMapStringString(m *map[string]string) *LangleSeparatedMapStringString
    func (m *LangleSeparatedMapStringString) Empty() bool
    func (m *LangleSeparatedMapStringString) Set(value string) error
    func (m *LangleSeparatedMapStringString) String() string
    func (*LangleSeparatedMapStringString) Type() string
type MapStringBool
    func NewMapStringBool(m *map[string]bool) *MapStringBool
    func (m *MapStringBool) Empty() bool
    func (m *MapStringBool) Set(value string) error
    func (m *MapStringBool) String() string
    func (*MapStringBool) Type() string
type MapStringString
    func NewMapStringString(m *map[string]string) *MapStringString
    func NewMapStringStringNoSplit(m *map[string]string) *MapStringString
    func (m *MapStringString) Empty() bool
    func (m *MapStringString) Set(value string) error
    func (m *MapStringString) String() string
    func (*MapStringString) Type() string
type NamedCertKey
    func (nkc *NamedCertKey) Set(value string) error
    func (nkc *NamedCertKey) String() string
    func (*NamedCertKey) Type() string
type NamedCertKeyArray
    func NewNamedCertKeyArray(p *[]NamedCertKey) *NamedCertKeyArray
    func (a *NamedCertKeyArray) Set(val string) error
    func (a *NamedCertKeyArray) String() string
    func (a *NamedCertKeyArray) Type() string
type NamedFlagSets
    func (nfs *NamedFlagSets) FlagSet(name string) *pflag.FlagSet
type NoOp
    func (NoOp) Set(val string) error
    func (NoOp) String() string
    func (NoOp) Type() string
type OmitEmpty
type StringFlag
    func NewStringFlag(defaultVal string) StringFlag
    func (f *StringFlag) Default(value string)
    func (f StringFlag) Provided() bool
    func (f *StringFlag) Set(value string) error
    func (f StringFlag) String() string
    func (f *StringFlag) Type() string
    func (f StringFlag) Value() string
type StringSlice
    func NewStringSlice(s *[]string) *StringSlice
    func (s *StringSlice) Set(val string) error
    func (s *StringSlice) String() string
    func (StringSlice) Type() string
type Tristate
    func (f *Tristate) Default(value bool)
    func (f Tristate) Provided() bool
    func (f *Tristate) Set(value string) error
    func (f Tristate) String() string
    func (f *Tristate) Type() string
    func (f Tristate) Value() bool

Package files

ciphersuites_flag.go colon_separated_multimap_string_string.go configuration_map.go flags.go langle_separated_map_string_string.go map_string_bool.go map_string_string.go namedcertkey_flag.go noop.go omitempty.go sectioned.go string_flag.go string_slice_flag.go tristate.go

func DefaultTLSVersion

func DefaultTLSVersion() uint16

DefaultTLSVersion defines the default TLS Version.

func InitFlags

func InitFlags()

InitFlags normalizes, parses, then logs the command line flags

func InsecureTLSCipherNames

func InsecureTLSCipherNames() []string

InsecureTLSCipherNames returns a list of cipher suite names implemented by crypto/tls which have security issues.

func InsecureTLSCiphers

func InsecureTLSCiphers() map[string]uint16

InsecureTLSCiphers returns the cipher suites implemented by crypto/tls which have security issues.

func PreferredTLSCipherNames

func PreferredTLSCipherNames() []string

PreferredTLSCipherNames returns a list of cipher suite names implemented by crypto/tls.

func PrintFlags

func PrintFlags(flags *pflag.FlagSet)

PrintFlags logs the flags in the flagset

func PrintSections

func PrintSections(w io.Writer, fss NamedFlagSets, cols int)

PrintSections prints the given names flag sets in sections, with the maximal given column number. If cols is zero, lines are not wrapped.

func SetUsageAndHelpFunc

func SetUsageAndHelpFunc(cmd *cobra.Command, fss NamedFlagSets, cols int)

SetUsageAndHelpFunc set both usage and help function. Print the flag sets we need instead of all of them.

func TLSCipherPossibleValues

func TLSCipherPossibleValues() []string

TLSCipherPossibleValues returns all acceptable cipher suite names. This is a combination of both InsecureTLSCipherNames() and PreferredTLSCipherNames().

func TLSCipherSuites

func TLSCipherSuites(cipherNames []string) ([]uint16, error)

TLSCipherSuites returns a list of cipher suite IDs from the cipher suite names passed.

func TLSPossibleVersions

func TLSPossibleVersions() []string

TLSPossibleVersions returns all acceptable values for TLS Version.

func TLSVersion

func TLSVersion(versionName string) (uint16, error)

TLSVersion returns the TLS Version ID for the version name passed.

func WarnWordSepNormalizeFunc

func WarnWordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName

WarnWordSepNormalizeFunc changes and warns for flags that contain "_" separators

func WordSepNormalizeFunc

func WordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName

WordSepNormalizeFunc changes all flags that contain "_" separators

type ColonSeparatedMultimapStringString

ColonSeparatedMultimapStringString supports setting a map[string][]string from an encoding that separates keys from values with ':' and separates key-value pairs with ','. A key can be repeated multiple times, in which case the values are appended to a slice of strings associated with that key. Items in the list associated with a given key will appear in the order provided. For example: `a:hello,b:again,c:world,b:beautiful` results in `{"a": ["hello"], "b": ["again", "beautiful"], "c": ["world"]}` The first call to Set will clear the map before adding entries; subsequent calls will simply append to the map. This makes it possible to override default values with a command-line option rather than appending to defaults, while still allowing the distribution of key-value pairs across multiple flag invocations. For example: `--flag "a:hello" --flag "b:again" --flag "b:beautiful" --flag "c:world"` results in `{"a": ["hello"], "b": ["again", "beautiful"], "c": ["world"]}`

type ColonSeparatedMultimapStringString struct {
    Multimap *map[string][]string
    // contains filtered or unexported fields
}

func NewColonSeparatedMultimapStringString

func NewColonSeparatedMultimapStringString(m *map[string][]string) *ColonSeparatedMultimapStringString

NewColonSeparatedMultimapStringString takes a pointer to a map[string][]string and returns the ColonSeparatedMultimapStringString flag parsing shim for that map.

func (*ColonSeparatedMultimapStringString) Empty

func (m *ColonSeparatedMultimapStringString) Empty() bool

Empty implements OmitEmpty

func (*ColonSeparatedMultimapStringString) Set

func (m *ColonSeparatedMultimapStringString) Set(value string) error

Set implements github.com/spf13/pflag.Value

func (*ColonSeparatedMultimapStringString) String

func (m *ColonSeparatedMultimapStringString) String() string

String implements github.com/spf13/pflag.Value

func (*ColonSeparatedMultimapStringString) Type

func (m *ColonSeparatedMultimapStringString) Type() string

Type implements github.com/spf13/pflag.Value

type ConfigurationMap

type ConfigurationMap map[string]string

func (*ConfigurationMap) Set

func (m *ConfigurationMap) Set(value string) error

func (*ConfigurationMap) String

func (m *ConfigurationMap) String() string

func (*ConfigurationMap) Type

func (*ConfigurationMap) Type() string

type LangleSeparatedMapStringString

LangleSeparatedMapStringString can be set from the command line with the format `--flag "string<string"`. Multiple comma-separated key-value pairs in a single invocation are supported. For example: `--flag "a<foo,b<bar"`. Multiple flag invocations are supported. For example: `--flag "a<foo" --flag "b<foo"`.

type LangleSeparatedMapStringString struct {
    Map *map[string]string
    // contains filtered or unexported fields
}

func NewLangleSeparatedMapStringString

func NewLangleSeparatedMapStringString(m *map[string]string) *LangleSeparatedMapStringString

NewLangleSeparatedMapStringString takes a pointer to a map[string]string and returns the LangleSeparatedMapStringString flag parsing shim for that map

func (*LangleSeparatedMapStringString) Empty

func (m *LangleSeparatedMapStringString) Empty() bool

Empty implements OmitEmpty

func (*LangleSeparatedMapStringString) Set

func (m *LangleSeparatedMapStringString) Set(value string) error

Set implements github.com/spf13/pflag.Value

func (*LangleSeparatedMapStringString) String

func (m *LangleSeparatedMapStringString) String() string

String implements github.com/spf13/pflag.Value

func (*LangleSeparatedMapStringString) Type

func (*LangleSeparatedMapStringString) Type() string

Type implements github.com/spf13/pflag.Value

type MapStringBool

MapStringBool can be set from the command line with the format `--flag "string=bool"`. Multiple comma-separated key-value pairs in a single invocation are supported. For example: `--flag "a=true,b=false"`. Multiple flag invocations are supported. For example: `--flag "a=true" --flag "b=false"`.

type MapStringBool struct {
    Map *map[string]bool
    // contains filtered or unexported fields
}

func NewMapStringBool

func NewMapStringBool(m *map[string]bool) *MapStringBool

NewMapStringBool takes a pointer to a map[string]string and returns the MapStringBool flag parsing shim for that map

func (*MapStringBool) Empty

func (m *MapStringBool) Empty() bool

Empty implements OmitEmpty

func (*MapStringBool) Set

func (m *MapStringBool) Set(value string) error

Set implements github.com/spf13/pflag.Value

func (*MapStringBool) String

func (m *MapStringBool) String() string

String implements github.com/spf13/pflag.Value

func (*MapStringBool) Type

func (*MapStringBool) Type() string

Type implements github.com/spf13/pflag.Value

type MapStringString

MapStringString can be set from the command line with the format `--flag "string=string"`. Multiple flag invocations are supported. For example: `--flag "a=foo" --flag "b=bar"`. If this is desired to be the only type invocation `NoSplit` should be set to true. Multiple comma-separated key-value pairs in a single invocation are supported if `NoSplit` is set to false. For example: `--flag "a=foo,b=bar"`.

type MapStringString struct {
    Map *map[string]string

    NoSplit bool
    // contains filtered or unexported fields
}

func NewMapStringString

func NewMapStringString(m *map[string]string) *MapStringString

NewMapStringString takes a pointer to a map[string]string and returns the MapStringString flag parsing shim for that map

func NewMapStringStringNoSplit

func NewMapStringStringNoSplit(m *map[string]string) *MapStringString

NewMapStringString takes a pointer to a map[string]string and sets `NoSplit` value to `true` and returns the MapStringString flag parsing shim for that map

func (*MapStringString) Empty

func (m *MapStringString) Empty() bool

Empty implements OmitEmpty

func (*MapStringString) Set

func (m *MapStringString) Set(value string) error

Set implements github.com/spf13/pflag.Value

func (*MapStringString) String

func (m *MapStringString) String() string

String implements github.com/spf13/pflag.Value

func (*MapStringString) Type

func (*MapStringString) Type() string

Type implements github.com/spf13/pflag.Value

type NamedCertKey

NamedCertKey is a flag value parsing "certfile,keyfile" and "certfile,keyfile:name,name,name".

type NamedCertKey struct {
    Names             []string
    CertFile, KeyFile string
}

func (*NamedCertKey) Set

func (nkc *NamedCertKey) Set(value string) error

func (*NamedCertKey) String

func (nkc *NamedCertKey) String() string

func (*NamedCertKey) Type

func (*NamedCertKey) Type() string

type NamedCertKeyArray

NamedCertKeyArray is a flag value parsing NamedCertKeys, each passed with its own flag instance (in contrast to comma separated slices).

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

func NewNamedCertKeyArray

func NewNamedCertKeyArray(p *[]NamedCertKey) *NamedCertKeyArray

NewNamedKeyCertArray creates a new NamedCertKeyArray with the internal value pointing to p.

func (*NamedCertKeyArray) Set

func (a *NamedCertKeyArray) Set(val string) error

func (*NamedCertKeyArray) String

func (a *NamedCertKeyArray) String() string

func (*NamedCertKeyArray) Type

func (a *NamedCertKeyArray) Type() string

type NamedFlagSets

NamedFlagSets stores named flag sets in the order of calling FlagSet.

type NamedFlagSets struct {
    // Order is an ordered list of flag set names.
    Order []string
    // FlagSets stores the flag sets by name.
    FlagSets map[string]*pflag.FlagSet
    // NormalizeNameFunc is the normalize function which used to initialize FlagSets created by NamedFlagSets.
    NormalizeNameFunc func(f *pflag.FlagSet, name string) pflag.NormalizedName
}

func (*NamedFlagSets) FlagSet

func (nfs *NamedFlagSets) FlagSet(name string) *pflag.FlagSet

FlagSet returns the flag set with the given name and adds it to the ordered name list if it is not in there yet.

type NoOp

NoOp implements goflag.Value and plfag.Value, but has a noop Set implementation

type NoOp struct{}

func (NoOp) Set

func (NoOp) Set(val string) error

func (NoOp) String

func (NoOp) String() string

func (NoOp) Type

func (NoOp) Type() string

type OmitEmpty

OmitEmpty is an interface for flags to report whether their underlying value is "empty." If a flag implements OmitEmpty and returns true for a call to Empty(), it is assumed that flag may be omitted from the command line.

type OmitEmpty interface {
    Empty() bool
}

type StringFlag

StringFlag is a string flag compatible with flags and pflags that keeps track of whether it had a value supplied or not.

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

func NewStringFlag

func NewStringFlag(defaultVal string) StringFlag

func (*StringFlag) Default

func (f *StringFlag) Default(value string)

func (StringFlag) Provided

func (f StringFlag) Provided() bool

func (*StringFlag) Set

func (f *StringFlag) Set(value string) error

func (StringFlag) String

func (f StringFlag) String() string

func (*StringFlag) Type

func (f *StringFlag) Type() string

func (StringFlag) Value

func (f StringFlag) Value() string

type StringSlice

StringSlice implements goflag.Value and plfag.Value, and allows set to be invoked repeatedly to accumulate values.

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

func NewStringSlice

func NewStringSlice(s *[]string) *StringSlice

func (*StringSlice) Set

func (s *StringSlice) Set(val string) error

func (*StringSlice) String

func (s *StringSlice) String() string

func (StringSlice) Type

func (StringSlice) Type() string

type Tristate

Tristate is a flag compatible with flags and pflags that keeps track of whether it had a value supplied or not.

type Tristate int
const (
    Unset Tristate = iota // 0
    True
    False
)

func (*Tristate) Default

func (f *Tristate) Default(value bool)

func (Tristate) Provided

func (f Tristate) Provided() bool

func (*Tristate) Set

func (f *Tristate) Set(value string) error

func (Tristate) String

func (f Tristate) String() string

func (*Tristate) Type

func (f *Tristate) Type() string

func (Tristate) Value

func (f Tristate) Value() bool