console

package
v0.0.0-...-a360f25 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearScreen

func ClearScreen()

The ClearScreen function clears the screen. It is platform independent.

func Readline

func Readline() string

The Readline function waits for the user to type and then press Enter. Readline returns the typed string.

Types

type Console

type Console struct {
	// Controls the console loop
	Active bool

	// Displayed at the beginning of a line. Defaults to no linebreak. Possible value is "\n".
	Prompt string

	// Displayed when a command is not found.
	NotFound string

	// Displayed when first opened on the top line.
	Title string

	// Displayed between each line
	NewLine string
	// contains filtered or unexported fields
}

Console configurations

func New

func New(conf *config.Usechain) *Console

The New function creates an instance of the console type.

func (*Console) Add

func (con *Console) Add(keyword string, description string, function func(string))

The Add function registers a new console keyword, description (used in the help keyword), and function. The function must receive a string type which is the entire string of text the user typed in before pressing Enter.

func (*Console) Clear

func (con *Console) Clear()

The Clear function unregisters all the console keywords so they cannot be called.

func (*Console) Remove

func (con *Console) Remove(keyword string)

The Remove function unregisters a console keyword so it cannot be called.

func (*Console) Start

func (con *Console) Start()

The Start function starts the console loop where the user is prompted for keywords and then runs the associated functions.

Jump to

Keyboard shortcuts

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