cli

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

func New

func New(ctx stdContext.Context, name string, usage string) *App

func (*App) AddAfterFunc

func (a *App) AddAfterFunc(f Hook)

func (*App) AddBeforeFunc

func (a *App) AddBeforeFunc(f Hook)

func (*App) AddGlobalFlagsFromStruct

func (a *App) AddGlobalFlagsFromStruct(source interface{})

func (*App) RegisterCategory

func (a *App) RegisterCategory(category Category)

func (*App) RegisterCommand

func (a *App) RegisterCommand(command Command)

func (*App) Run

func (a *App) Run(args []string) error

type Category

type Category struct {
	Config

	SubCategories []Category
	SubCommands   []Command
}

type Command

type Command struct {
	Config

	Handler Handler
}

type Config

type Config = cli.Command

type Context

type Context struct {
	Ctx stdContext.Context
	Cli *cli.Context
	// contains filtered or unexported fields
}

func (*Context) Config

func (c *Context) Config() config.Global

func (*Context) Logger

func (c *Context) Logger() logging.Logger

func (*Context) SetConfig

func (c *Context) SetConfig(cfg config.Global)

func (*Context) SetLogger

func (c *Context) SetLogger(logger logging.Logger)

type Handler

type Handler interface {
	Execute(context *Context) error
}

type Hook

type Hook func(ctx *Context) error

func NewNopHook

func NewNopHook() Hook

type Hooks

type Hooks []Hook

func (Hooks) Execute

func (h Hooks) Execute(cliCtx *Context) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL