command

package
v0.0.0-...-107a783 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command interface {
	Name() string
	Execute(args ...string) error
}

type GenericCommand

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

func New

func New(name string, function func(...string) error) *GenericCommand

func (*GenericCommand) Execute

func (g *GenericCommand) Execute(args ...string) error

func (*GenericCommand) Name

func (g *GenericCommand) Name() string

type Registry

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

func NewRegistry

func NewRegistry(commands ...Command) *Registry

func (*Registry) Execute

func (c *Registry) Execute(name string, args ...string) error

func (*Registry) Get

func (c *Registry) Get(name string) (Command, bool)

func (*Registry) Register

func (c *Registry) Register(command Command)

Jump to

Keyboard shortcuts

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