scripts

package
v0.39.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildOptions added in v0.31.0

type BuildOptions struct {
	Globals          Declarations // globals.
	AllowShebangLine bool         // allow shebang line
	DisallowGoStmt   bool         // disallow "go" statement.
}

type Declarations

type Declarations map[string]interface{}

Declarations.

type RunOptions

type RunOptions struct {
	Context   context.Context
	PrintFunc runtime.PrintFunc
}

type Script

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

func Build added in v0.31.0

func Build(src io.Reader, packages scriggo.PackageLoader, options *BuildOptions) (*Script, error)

Build builds a script with the given options, loading the imported packages from packages.

func (*Script) Disassemble

func (p *Script) Disassemble() []byte

Disassemble disassembles the script and returns its assembly code.

func (*Script) MustRun

func (p *Script) MustRun(vars map[string]interface{}, options *RunOptions) int

MustRun is like Run but panics if the run fails.

func (*Script) Run

func (p *Script) Run(vars map[string]interface{}, options *RunOptions) (int, error)

Run starts the script and waits for it to complete. vars contains the values of the global variables.

Jump to

Keyboard shortcuts

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