console

package
v0.0.0-...-666a20f Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPrompt = "> "

DefaultPrompt is the default prompt line prefix to use for user input querying.

View Source
const HistoryFile = "history"

HistoryFile is the file within the data directory to store input scrollback.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DataDir  string              // Data directory to store the console history at
	DocRoot  string              // Filesystem path from where to load JavaScript files from
	Client   *rpc.Client         // RPC client to execute Entropy requests through
	Prompt   string              // Input prompt prefix string (defaults to DefaultPrompt)
	Prompter prompt.UserPrompter // Input prompter to allow interactive user feedback (defaults to TerminalPrompter)
	Printer  io.Writer           // Output writer to serialize any display strings to (defaults to os.Stdout)
	Preload  []string            // Absolute paths to JavaScript files to preload
}

Config is the collection of configurations to fine tune the behavior of the JavaScript console.

type Console

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

Console is a JavaScript interpreted runtime environment. It is a fully fleged JavaScript console attached to a running node via an external or in-process RPC client.

func New

func New(config Config) (*Console, error)

New initializes a JavaScript interpreted runtime environment and sets defaults with the config struct.

func (*Console) AutoCompleteInput

func (c *Console) AutoCompleteInput(line string, pos int) (string, []string, string)

AutoCompleteInput is a pre-assembled word completer to be used by the user input prompter to provide hints to the user about the methods available.

func (*Console) Evaluate

func (c *Console) Evaluate(statement string)

Evaluate executes code and pretty prints the result to the specified output stream.

func (*Console) Interactive

func (c *Console) Interactive()

Interactive starts an interactive user session, where in.put is propted from the configured user prompter.

func (*Console) Stop

func (c *Console) Stop(graceful bool) error

Stop cleans up the console and terminates the runtime environment.

func (*Console) StopInteractive

func (c *Console) StopInteractive()

StopInteractive causes Interactive to return as soon as possible.

func (*Console) Welcome

func (c *Console) Welcome()

Welcome show summary of current Entropy instance and some metadata about the console's available modules.

Directories

Path Synopsis
Package jsre provides execution environment for JavaScript.
Package jsre provides execution environment for JavaScript.
package web3ext contains geth specific web3.js extensions.
package web3ext contains geth specific web3.js extensions.

Jump to

Keyboard shortcuts

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