repl

package module
v0.0.0-...-905db67 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2015 License: MIT Imports: 4 Imported by: 0

README

gorepl

easy to use repl package

Install

go get github.com/paulvollmer/gorepl

Usage

Check out the examples directory

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Keyword     string
	Description string
	Action      ContextFn
}

type Context

type Context struct {
	Keyword string
	History []string
}

func (*Context) Write

func (c *Context) Write(a ...interface{})

func (*Context) Writef

func (c *Context) Writef(format string, a ...interface{})

func (*Context) Writeln

func (c *Context) Writeln(a ...interface{})

type ContextFn

type ContextFn func(Context)

type REPL

type REPL struct {
	Name           string
	Prompt         string
	Version        string
	Author         string
	AuthorEmail    string
	WelcomeMessage string
	Commands       []Command

	History []string
	// contains filtered or unexported fields
}

func NewREPL

func NewREPL(name string) *REPL

func (*REPL) Command

func (r *REPL) Command(keyword, description string, action ContextFn)

func (*REPL) CommandUnknown

func (r *REPL) CommandUnknown(action ContextFn)

func (*REPL) GetHelpText

func (r *REPL) GetHelpText() string

func (*REPL) Run

func (r *REPL) Run()

Jump to

Keyboard shortcuts

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