commands

package
Version: v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	Registrable
}

Category is a group of executable CLI commands

type Command

type Command struct {
	Registrable
	Handler Executable
}

Command is an instance of executable CLI invocation

type Config

type Config cli.Command

Command configuration, using `urfave/cli`

type Context

type Context struct {
	Cli *cli.Context
	Ctx context.Context
	env.Env
}

CLI action function invocation context

type Executable

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

Executable is an interface for an executable action

type Register

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

Commands register

func NewRegister

func NewRegister() *Register

func (*Register) GetCommands

func (register *Register) GetCommands() []cli.Command

Returns all registered categories and commands as `cli.Command` tree

func (*Register) RegisterCategory

func (register *Register) RegisterCategory(category Category)

Adds a new category to the Register

func (*Register) RegisterCommand

func (register *Register) RegisterCommand(command Command)

Adds a new command to the Register

type Registrable

type Registrable struct {
	Path string
	Config
}

Registrable is an entity that can be registered in commands graph / tree

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL