Documentation ¶
Index ¶
- Variables
- func Run(opts ...Option) error
- type Author
- type Command
- type Commandor
- type Context
- type Flag
- type Flager
- type Handler
- type Instance
- type IntFlag
- type Option
- func App(app Instance) Option
- func BuildTime(buildTime string) Option
- func BuildVersion(buildVersion string) Option
- func Commands(cmds ...Commandor) Option
- func Config(src, conf interface{}) Option
- func Debug(args ...bool) Option
- func Flags(flags ...Flager) Option
- func Logger(log logger.Logger) Option
- func MigrationsPath(path string) Option
- func Name(name string) Option
- func Trigger(action, before, after Handler) Option
- func Usage(descr string) Option
- func Users(users []cli.Author) Option
- type Options
- type RunOptions
- type StringFlag
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrAppNotPointer when app-instance not pointer to struct ErrAppNotPointer = errors.New("app must be a pointer to a struct") // ErrConfigNotPointer when app-instance not pointer to struct ErrConfigNotPointer = errors.New("config must be a pointer to a struct") )
Functions ¶
func Run ¶ added in v1.7.1
Run creates instance of cli.App with Options. Validate options with https://github.com/go-playground/validator Required: - App instance - Logger
Types ¶
type Instance ¶
type Instance interface { Run(RunOptions) error Shutdown(ctx context.Context) error }
Instance abstraction layer above Application
type Option ¶
type Option func(*Options)
Option closure
func BuildVersion ¶
BuildVersion closure to set field in Options
func Config ¶ added in v1.7.1
func Config(src, conf interface{}) Option
Config closure to set config source and interface in Options
func MigrationsPath ¶ added in v1.8.1
MigrationsPath closure to set param in Options
type Options ¶
type Options struct { App Instance Logger logger.Logger `validate:"required"` ConfigSource interface{} `validate:"required"` ConfigInterface interface{} `validate:"required"` DB *pg.DB Redis *redis.Client Users []cli.Author Debug bool Quiet bool Usage string Name string BuildTime string BuildVersion string // contains filtered or unexported fields }
Options for creating cli.App instance
type RunOptions ¶ added in v1.7.1
type RunOptions struct { DB *pg.DB Redis *redis.Client Logger logger.Logger Debug bool BuildTime string BuildVersion string }
RunOptions for pass db, redis, etc to application:
type StringFlag ¶ added in v1.9.1
type StringFlag = cli.StringFlag
Click to show internal directories.
Click to hide internal directories.