cmd

package module
v0.0.0-...-5a22cc5 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2018 License: BSD-2-Clause Imports: 2 Imported by: 0

README

cmd

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

Engine is the core interface to the command interpreter.

func NewEngine

func NewEngine() *Engine

NewEngine creates a new command interpreter.

func (*Engine) AddCommand

func (e *Engine) AddCommand(name string, help string, handler Handler, userLevel int) error

AddCommand adds a command to the engine.

func (*Engine) Exec

func (e *Engine) Exec(ctx interface{}, userLevel int, args []string) error

Exec executes a command.

func (*Engine) ExecString

func (e *Engine) ExecString(ctx interface{}, userLevel int, commandString string) error

ExecString parses the commandString and executes the command.

func (*Engine) RemoveCommand

func (e *Engine) RemoveCommand(name string) error

RemoveCommand removes a command from the engine.

type Handler

type Handler func(ctx interface{}, args []string) error

Handler is a function that gets invoked when a command is run.

Jump to

Keyboard shortcuts

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