Documentation ¶
Index ¶
- Variables
- func MergeFlags(flags1, flags2 []cli.Flag, ignoreError ...bool) ([]cli.Flag, error)
- func Print(cliCtx *cli.Context, msgLst ...interface{}) (err error)
- func Println(cliCtx *cli.Context, msgLst ...interface{}) (err error)
- func SetCustomOptions(opt CustomOption)
- func ToApp(cmd *cli.Command) (*cli.App, error)
- type Builder
- func (cb *Builder) Action(action cli.ActionFunc) *Builder
- func (cb *Builder) Base() *Builder
- func (cb *Builder) BuildBase() *cli.Command
- func (cb *Builder) BuildCur() *cli.Command
- func (cb *Builder) Child(cmd string) *Builder
- func (cb *Builder) Cur() *Builder
- func (cb *Builder) Flags(flags ...cli.Flag) *Builder
- func (cb *Builder) Handler(handler ICliHandler, mws ...Middleware) *Builder
- func (cb *Builder) RunBaseAsApp() error
- func (cb *Builder) RunBaseAsAppWithCtx(ctx context.Context) error
- func (cb *Builder) SubCmd(child *cli.Command) *Builder
- type CustomOption
- type ICliHandler
- type Middleware
- type Setter
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrFlagAlreadyExist = errors.New("flag already exists")
Functions ¶
func MergeFlags ¶
SetCustomOptions can merge two list of cli.Flags
func SetCustomOptions ¶
func SetCustomOptions(opt CustomOption)
SetCustomOptions can set some easycmd-layer options
Types ¶
type Builder ¶
type Builder struct { Set *Setter // contains filtered or unexported fields }
func (*Builder) BuildBase ¶
func (cb *Builder) BuildBase() *cli.Command
BuildBase returns root Builder's cmd
func (*Builder) BuildCur ¶
func (cb *Builder) BuildCur() *cli.Command
BuildCur returns current Builder's cmd
func (*Builder) Handler ¶
func (cb *Builder) Handler(handler ICliHandler, mws ...Middleware) *Builder
Handler method sets the cmd by a ICliHandler
func (*Builder) RunBaseAsApp ¶
RunBaseAsApp runs the command as a single app
func (*Builder) RunBaseAsAppWithCtx ¶
RunBaseAsAppWithCtx runs the command as a single app
type CustomOption ¶
type CustomOption struct {
ExitAfterPrintHelpMsg bool
}
type ICliHandler ¶
type ICliHandler interface { Flags() []cli.Flag Parse(c *cli.Context) (ICliHandler, error) Handle(c *cli.Context) error }
type Middleware ¶
type Middleware func(cli.ActionFunc) cli.ActionFunc
Source Files ¶
Click to show internal directories.
Click to hide internal directories.