Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Context ¶
type Context interface { Client() service.Client RegisterCommand(name, helpMsg string, cmdfn func(args string) error) CallCommand(cmdstr string) error Scope() api.EvalScope LoadConfig() api.LoadConfig }
Context is the context in which starlark scripts are evaluated. It contains methods to call API functions, command line commands, etc.
type EchoWriter ¶ added in v1.8.1
type Env ¶
type Env struct {
// contains filtered or unexported fields
}
Env is the environment used to evaluate starlark scripts.
func New ¶
func New(ctx Context, out EchoWriter) *Env
New creates a new starlark binding environment.
func (*Env) Cancel ¶
func (env *Env) Cancel()
Cancel cancels the execution of a currently running script or function.
func (*Env) Execute ¶
func (env *Env) Execute(path string, source interface{}, mainFnName string, args []interface{}) (starlark.Value, error)
Execute executes a script. Path is the name of the file to execute and source is the source code to execute. Source can be either a []byte, a string or a io.Reader. If source is nil Execute will execute the file specified by 'path'. After the file is executed if a function named mainFnName exists it will be called, passing args to it.
func (*Env) Redirect ¶ added in v1.8.1
func (env *Env) Redirect(out EchoWriter)
Redirect redirects starlark output to out.