Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetAndBindFlag ¶
func SetAndBindFlag(client *ConfigClient, name string, shorthand string, value any, description string) error
SetAndBindFlag sets and binds a flag to a command and viper.
Note these are some unsupported types: map[string]interface{}, map[string][]string, time.Time
Types ¶
type Client ¶
type Client[C schemas.BaseConfiguration] interface { GetConfig() C SetAndBindFlag(name string, shorthand string, value any, description string) error }
Client interface
type ClientGetter ¶
type ClientGetter struct{}
ClientGetter is an struct for getting a BB config client.
type ConfigClient ¶
type ConfigClient struct {
// contains filtered or unexported fields
}
ConfigClient is composed of functions to interact with configuration.
func NewClient ¶
func NewClient( getConfig GetConfigFunc, setAndBindFlag SetAndBindFlagFunc, loggingClient *bbLog.Client, command *cobra.Command, viperInstance *viper.Viper, ) (*ConfigClient, error)
NewClient returns a new config client with the provided configuration
func (*ConfigClient) GetConfig ¶
func (client *ConfigClient) GetConfig() (*schemas.GlobalConfiguration, error)
GetConfig returns the global configuration.
func (*ConfigClient) SetAndBindFlag ¶
func (client *ConfigClient) SetAndBindFlag(name string, shorthand string, value any, description string) error
SetAndBindFlag sets and binds a flag to a command and viper.
type GetConfigFunc ¶
type GetConfigFunc func(*ConfigClient) (*schemas.GlobalConfiguration, error)
GetConfigFunc type
type SetAndBindFlagFunc ¶
SetAndBindFlagFunc type
Click to show internal directories.
Click to hide internal directories.