Documentation ¶
Index ¶
- Variables
- func Run(opts ...Option) error
- type Author
- type Command
- type Commandor
- type Context
- type Flag
- type Instance
- type IntFlag
- type Option
- func App(app Instance) Option
- func BuildTime(buildTime string) Option
- func BuildVersion(buildVersion string) Option
- func Commands(commands ...Commandor) Option
- func Config(src, conf interface{}) Option
- func Debug(args ...bool) Option
- func Flags(flags ...Flag) Option
- func Logger(log logger.Logger) Option
- func MigrationsPath(path string) Option
- func Name(name string) Option
- func Usage(descr string) Option
- func Users(users []cli.Author) Option
- type Options
- type RunOptions
- type StringFlag
Constants ¶
This section is empty.
Variables ¶
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 Context ¶ added in v1.8.1
Context is a type that is passed through to each Handler action in a cli application. Context can be used to retrieve context-specific Args and parsed command-line options.
type Flag ¶ added in v1.9.1
Flag is a common interface related to parsing flags in cli. For more advanced flag parsing techniques, it is recommended that this interface be implemented.
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:
func NewRunOptions ¶ added in v1.18.0
func NewRunOptions(opts *Options) (RunOptions, error)
type StringFlag ¶ added in v1.9.1
type StringFlag = cli.StringFlag
StringFlag is a flag with type string