Documentation ¶
Index ¶
- Variables
- func ConfigFromContext(ctx context.Context) interface{}
- func FileMustExistOpt() configOpt
- func FilePathOpt(path string) configOpt
- func FsFromContext(ctx context.Context) afero.Fs
- func LoggerFromContext(ctx context.Context) zerolog.Logger
- func Run(a App, e Executor) error
- func UpdateLoggerConfigPreRun(ctx context.Context) error
- type App
- type CobraExecutor
- type Command
- type Config
- type ContextKey
- type Descriptions
- type ErrCommandNotCastable
- type ErrCouldNotBuildRequiredCommandimplementation
- type ErrFlagTypeNotImplemented
- type ErrIncorrectInitialValueForFlag
- type ErrIncorrectValueRefForFlag
- type ErrOverridingConfigWithEnvFailed
- type ErrReadingFile
- type ErrUnmarshallingYAML
- type Executor
- type Flag
- type HandlerFunc
- type LogManager
- type ValueType
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCannotUseNonPointerValue error = errors.New("cannot use non-pointer value")
View Source
var ErrConfigMustBeAPointer error = errors.New("cannot use non-pointer value for config")
View Source
var ErrConfigMustPointToAStruct error = errors.New("cannot point to non-struct value for config")
View Source
var ErrConfigNotFound error = errors.New("config file does not exist")
View Source
var ErrInvalidLogFormat error = errors.New("log format must be one of: console, json")
View Source
var ErrLogFormatMustBeString error = errors.New("log format type in config struct must be string")
View Source
var ErrLogLevelMustBeInt error = errors.New("log level type in config struct must be int")
Functions ¶
func ConfigFromContext ¶
func FileMustExistOpt ¶
func FileMustExistOpt() configOpt
func FilePathOpt ¶
func FilePathOpt(path string) configOpt
Types ¶
type CobraExecutor ¶
type CobraExecutor struct {
// contains filtered or unexported fields
}
func NewCobraExecutor ¶
func NewCobraExecutor() *CobraExecutor
type Command ¶
type Command struct { Name string Descriptions Descriptions LocalFlags []Flag PersistentFlags []Flag Handle HandlerFunc CustomConfiguration func(*cobra.Command) Children []Command }
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func (*Config) OverrideWithEnvVars ¶
type ContextKey ¶
type ContextKey string
const ConfigContextKey ContextKey = "APP_CONFIG"
const ConfigManagerContextKey ContextKey = "CONFIG_MANAGER"
const FsContextKey ContextKey = "FILESYSTEM"
const LogManagerContextKey ContextKey = "LOG_MANAGER"
type Descriptions ¶
type ErrCommandNotCastable ¶
type ErrCommandNotCastable struct {
CastingTo string
}
func (ErrCommandNotCastable) Error ¶
func (e ErrCommandNotCastable) Error() string
type ErrCouldNotBuildRequiredCommandimplementation ¶
type ErrCouldNotBuildRequiredCommandimplementation struct {
// contains filtered or unexported fields
}
func (ErrCouldNotBuildRequiredCommandimplementation) Error ¶
func (e ErrCouldNotBuildRequiredCommandimplementation) Error() string
type ErrFlagTypeNotImplemented ¶
type ErrFlagTypeNotImplemented struct {
// contains filtered or unexported fields
}
func (ErrFlagTypeNotImplemented) Error ¶
func (e ErrFlagTypeNotImplemented) Error() string
type ErrIncorrectInitialValueForFlag ¶
type ErrIncorrectInitialValueForFlag struct {
// contains filtered or unexported fields
}
func (ErrIncorrectInitialValueForFlag) Error ¶
func (e ErrIncorrectInitialValueForFlag) Error() string
type ErrIncorrectValueRefForFlag ¶
type ErrIncorrectValueRefForFlag struct {
// contains filtered or unexported fields
}
func (ErrIncorrectValueRefForFlag) Error ¶
func (e ErrIncorrectValueRefForFlag) Error() string
type ErrOverridingConfigWithEnvFailed ¶
type ErrOverridingConfigWithEnvFailed struct {
// contains filtered or unexported fields
}
func (ErrOverridingConfigWithEnvFailed) Error ¶
func (e ErrOverridingConfigWithEnvFailed) Error() string
type ErrReadingFile ¶
type ErrReadingFile struct {
// contains filtered or unexported fields
}
func (ErrReadingFile) Error ¶
func (e ErrReadingFile) Error() string
type ErrUnmarshallingYAML ¶
type ErrUnmarshallingYAML struct {
// contains filtered or unexported fields
}
func (ErrUnmarshallingYAML) Error ¶
func (e ErrUnmarshallingYAML) Error() string
type LogManager ¶
type LogManager struct {
// contains filtered or unexported fields
}
func LogManagerFromContext ¶
func LogManagerFromContext(ctx context.Context) *LogManager
func (*LogManager) ChangeLevel ¶
func (lm *LogManager) ChangeLevel(l int)
func (*LogManager) ChangeOutput ¶
func (lm *LogManager) ChangeOutput(f string) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.