cmd

package
v0.0.0-...-a968a3f Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd interface {
	Prefix() []byte               // prefix of command, used for pattern matching
	Match(string) error           // whether the parameter is matching current command
	Run(string, RunContext) error // execute command
	String() string
}

type Cmds

type Cmds struct {
	// contains filtered or unexported fields
}
var (
	AllCommands *Cmds = new(Cmds)
)

func (*Cmds) Get

func (c *Cmds) Get(line string) (Cmd, error)

func (*Cmds) Put

func (c *Cmds) Put(cmds ...Cmd) error

func (*Cmds) Run

func (c *Cmds) Run(line string, ctx RunContext) (exist bool, err error)

type DynamicCmd

type DynamicCmd string

func (DynamicCmd) Prefix

func (d DynamicCmd) Prefix() []byte

func (DynamicCmd) String

func (d DynamicCmd) String() string

type RunContext

type RunContext interface {
	NetworkManager() models.NetworkManager // network service interface
	DataManager() models.DataManager       // data service interface
	Engine() models.Engine                 // consensus engine
	Eventer() models.Eventer               // event queue
	Config() *config.Config                // system configuration
}

type SingleCmd

type SingleCmd string

func (SingleCmd) Match

func (s SingleCmd) Match(line string) error

func (SingleCmd) Prefix

func (s SingleCmd) Prefix() []byte

func (SingleCmd) String

func (s SingleCmd) String() string

Jump to

Keyboard shortcuts

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