Documentation ¶
Index ¶
- type Options
- func (o *Options) CurrentValues() string
- func (o *Options) Descriptions() string
- func (o *Options) FlagsSpecified() sets.String
- func (o *Options) GetBool(key string) *bool
- func (o *Options) GetDuration(key string) *time.Duration
- func (o *Options) GetInt(key string) *int
- func (o *Options) GetString(key string) *string
- func (o *Options) GetStringSlice(key string) *[]string
- func (o *Options) GetUint64(key string) *uint64
- func (o *Options) Load(file string) (sets.String, error)
- func (o *Options) PopulateFromFlags()
- func (o *Options) PopulateFromString(yaml string) sets.String
- func (o *Options) RegisterBool(ptr *bool, key string, defaultVal bool, description string)
- func (o *Options) RegisterDuration(ptr *time.Duration, key string, defaultVal time.Duration, description string)
- func (o *Options) RegisterInt(ptr *int, key string, defaultVal int, description string)
- func (o *Options) RegisterString(ptr *string, key string, defaultVal string, description string)
- func (o *Options) RegisterStringSlice(ptr *[]string, key string, defaultVal []string, description string)
- func (o *Options) RegisterUint64(ptr *uint64, key string, defaultVal uint64, description string)
- func (o *Options) RegisterUpdateCallback(callback UpdateCallback)
- func (o *Options) ToFlags()
- type UpdateCallback
- type UpdateCallbackError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
Options represents the configuration options for mungegithub.
Options are loaded from a yaml string->string configmap and are updated whenever Load is called. Options must be registered at least once before they can be retrieved, but registration and loading may happen in any order (this makes Options compatible with a plugin architecture). Option keys must be unique across all options of all types. Options may be registered multiple times safely so long as the option is always bound to the same pointer. (registration is idempotent) The defaultVal is used if the options does not have a value specified. The description explains the option as an entry in the text returned by Descriptions().
func (*Options) CurrentValues ¶
func (*Options) Descriptions ¶
func (*Options) FlagsSpecified ¶
FlagsSpecified returns the names of the flags that were specified that correspond to options. This function must have been proceeded by a call to ToFlags and the flags must have been parsed since then.
func (*Options) GetDuration ¶
GetDuration gets the `time.Duration` option under the specified key.
func (*Options) GetStringSlice ¶
GetStringSlice gets the `[]string` option under the specified key.
func (*Options) Load ¶
Load updates options based on the contents of a config file and returns the set of changed options.
func (*Options) PopulateFromFlags ¶
func (o *Options) PopulateFromFlags()
PopulateFromFlags loads values into options from command line flags. This function must be proceeded by a call to ToFlags and the flags must have been parsed since then.
func (*Options) PopulateFromString ¶
PopulateFromString loads values from the provided yaml string and returns the set of changed options. This function should only be used in tests where the config is not loaded from a file.
func (*Options) RegisterBool ¶
RegisterBool registers a `bool` option under the specified key.
func (*Options) RegisterDuration ¶
func (o *Options) RegisterDuration(ptr *time.Duration, key string, defaultVal time.Duration, description string)
RegisterDuration registers a `time.Duration` option under the specified key.
func (*Options) RegisterInt ¶
RegisterInt registers an `int` option under the specified key.
func (*Options) RegisterString ¶
RegisterString registers a `string` option under the specified key.
func (*Options) RegisterStringSlice ¶
func (o *Options) RegisterStringSlice(ptr *[]string, key string, defaultVal []string, description string)
RegisterStringSlice registers a `[]string` option under the specified key.
func (*Options) RegisterUint64 ¶
RegisterUint64 registers a `uint64` option under the specified key.
func (*Options) RegisterUpdateCallback ¶
func (o *Options) RegisterUpdateCallback(callback UpdateCallback)
type UpdateCallback ¶
type UpdateCallbackError ¶
type UpdateCallbackError struct {
// contains filtered or unexported fields
}
func (*UpdateCallbackError) Error ¶
func (e *UpdateCallbackError) Error() string