smonkey

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Monkey monkeyEngine = 0xD1

Monkey is a mapping for the Monkey (github.com/skx/monkey) Scripting engine. This can be used to run Monkey scripts directly and can be registered by the 'task.RegisterScript' function to include the engine in the XMT task runtime.

Variables

This section is empty.

Functions

func Invoke

func Invoke(s string) (string, error)

Invoke will use the Monkey (github.com/skx/monkey) Scripting engine. This can be used to run code not built in at compile time. The only argument is the script that is to be run. The results are the output of the console (all print* together) and any errors that may occur or syntax errors.

This will capture the output of all the console writes and adds a 'print*' statement as a shortcut to be used. Another additional function 'exec' can be used to run commands natively. This function can take a vardict of strings to be the command line arguments.

func InvokeContext

func InvokeContext(x context.Context, s string) (string, error)

InvokeContext will use the Monkey (github.com/skx/monkey) Scripting engine. This can be used to run code not built in at compile time. A context is required to timeout the script execution and the script to be run, as a string. The results are the output of the console (all print* together) and any errors that may occur or syntax errors.

This will capture the output of all the console writes and adds a 'print*' statement as a shortcut to be used. Another additional function 'exec' can be used to run commands natively. This function can take a vardict of strings to be the command line arguments.

Context cancelation is UNSUPPORTED at this time. See: https://github.com/skx/monkey/issues/79

func InvokeEx

func InvokeEx(_ context.Context, m map[string]interface{}, s string) (string, error)

InvokeEx will use the Monkey (github.com/skx/monkey) Scripting engine. This can be used to run code not built in at compile time. A context is required to timeout the script execution and the script to be run, as a string. The results are the output of the console (all print* together) and any errors that may occur or syntax errors.

This will capture the output of all the console writes and adds a 'print*' statement as a shortcut to be used. Another additional function 'exec' can be used to run commands natively. This function can take a vardict of strings to be the command line arguments.

This Ex function allows to specify a map that contains any starting variables to be supplied at runtime.

Context cancelation is UNSUPPORTED at this time. See: https://github.com/skx/monkey/issues/79

func Register

func Register() error

Register is a simple shortcut for 'task.RegisterEngine(uint8(Monkey), Monkey)'.

Types

This section is empty.

Jump to

Keyboard shortcuts

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