cli

package
v0.1.195 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package cli provides an Evy runtime to for Evy CLI execution in terminal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option added in v0.1.88

type Option func(*Runtime)

Option is used on Runtime creation to set optional parameters.

func WithCls added in v0.1.130

func WithCls(clsFn func()) Option

WithCls sets the action to be done for `cls` command.

func WithOutputWriter added in v0.1.100

func WithOutputWriter(w io.Writer) Option

WithOutputWriter sets the text output writer, which defaults to os.Stdout.

func WithSVG added in v0.1.88

func WithSVG(svgStyle string) Option

WithSVG sets up an SVG graphics runtime and writes its output to the given writer.

func WithSkipSleep added in v0.1.88

func WithSkipSleep(skipSleep bool) Option

WithSkipSleep sets the SkipSleep field Runtime and is intended to be used with NewRuntime.

type Runtime

type Runtime struct {
	evaluator.GraphicsRuntime

	SkipSleep bool
	// contains filtered or unexported fields
}

Runtime implements evaluator.Runtime.

func NewRuntime

func NewRuntime(options ...Option) *Runtime

NewRuntime returns an initialized cli runtime.

func (*Runtime) Cls

func (rt *Runtime) Cls()

Cls clears the screen.

func (*Runtime) Print

func (rt *Runtime) Print(s string)

Print prints s to stdout.

func (*Runtime) Read

func (rt *Runtime) Read() string

Read reads a line of input from stdin and strips trailing newline.

func (*Runtime) Sleep

func (rt *Runtime) Sleep(dur time.Duration)

Sleep sleeps for dur. If the --skip-sleep flag is used, it does nothing.

func (*Runtime) WriteSVG added in v0.1.88

func (rt *Runtime) WriteSVG(w io.Writer) error

WriteSVG writes the graphics output in SVG format to the writer set with option WithSVGWriter.

func (*Runtime) Yielder

func (*Runtime) Yielder() evaluator.Yielder

Yielder returns a no-op yielder for CLI evy as it is not needed. By contrast, browser Evy needs to explicitly hand over control to JS host with Yielder.

Directories

Path Synopsis
Package svg provides an Evy runtime to generate SVG output for evy programs that contain graphics function calls.
Package svg provides an Evy runtime to generate SVG output for evy programs that contain graphics function calls.

Jump to

Keyboard shortcuts

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