cli

package
v0.1.207 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package cli provides an Evy platform 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(*Platform)

Option is used on Platform 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, svgWidth string, svgHeight string) Option

WithSVG sets up an SVG graphics platform 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 Platform and is intended to be used with NewPlatform.

type Platform added in v0.1.206

type Platform struct {
	evaluator.GraphicsPlatform

	SkipSleep bool
	// contains filtered or unexported fields
}

Platform implements evaluator.Platform.

func NewPlatform added in v0.1.206

func NewPlatform(options ...Option) *Platform

NewPlatform returns an initialized cli platform.

func (*Platform) Cls added in v0.1.206

func (rt *Platform) Cls()

Cls clears the screen.

func (*Platform) Print added in v0.1.206

func (rt *Platform) Print(s string)

Print prints s to stdout.

func (*Platform) Read added in v0.1.206

func (rt *Platform) Read() string

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

func (*Platform) Sleep added in v0.1.206

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

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

func (*Platform) WriteSVG added in v0.1.206

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

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

func (*Platform) Yielder added in v0.1.206

func (*Platform) 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 platform to generate SVG output for evy programs that contain graphics function calls.
Package svg provides an Evy platform 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