cmd

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	QUIT_CMD = [3]string{"quit", "q", "exit"}
)

Functions

This section is empty.

Types

type CommandInterpreter

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

func NewCommandInterpreter

func NewCommandInterpreter() *CommandInterpreter

func (*CommandInterpreter) AddCommand

func (c *CommandInterpreter) AddCommand(cmd ICommand)

func (*CommandInterpreter) Execute

func (c *CommandInterpreter) Execute(rawCmdExp string) string

func (*CommandInterpreter) IsQuitCmd

func (c *CommandInterpreter) IsQuitCmd(rawCmdExp string) bool

type ICommand

type ICommand interface {
	Run([]string) string
	Help() string
	Name() string
}

type ICommandInterpreter

type ICommandInterpreter interface {
	AddCommand(ICommand)
	Execute(string) string
	IsQuitCmd(string) bool
}

Jump to

Keyboard shortcuts

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