simone

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 3 Imported by: 0

README

simone

GoDoc

New kind of tool.

usage

Simone is a package to build a Javascript engine with plugins in Go. By implementing exposed methods on plugins, functions are added to the runtime. See examples for a minimal program.

run flags

-c  start a client REPL
-h  show help
-i  string
    run the script from filename as input
-s  string
    run script from filename on startup
-v  verbose logging

optional plugins

plugin description
fs access to the local filesystem

builtin functions

console.log(arg,arg,...); // write log line
log(arg,arg,...);         // write log line (short version)
include('lib.sim');       // evaluate script from file

usage REPL

Commands start with the colon : prefix.

command description
:q quit the tool
:h show help
:d toggle verbose logging
:v show list of global variables
:p show list of available plugin names

If you postfix a variable (or plugin) with a ? then it will print all available functions. If you postfix an entry with a ! then it browse the result in a Web page. The last expression value is stored in the variable _.

usage HTTP

POST | GET http://localhost:9119/v1?action=<ACTION>&source=<ENTRY>&file=<FILE>&line=<LINE>

For POST the source is transported with the request body For GET the source can be passed as a query parameter. You can change the HTTP listen port by passing the PORT environment variable.

action description
eval evaluate the source and return a EvalResult in JSON
inspect evaluate the source and return an InspectResult in JSON
hover lookup a variable, plugin or function and return a HoverResult in JSON

advanced

There are some (unsupported) hidden functions used by the REPL that could be used in scripts: See also localRunner::initInternals.

_browse(expression)

Opens the browser on the result of evaluating the expression.

_markdowninspect(expression)

Returns Markdown for inspecting the result of evaluating the expression.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RegisterPrinter = core.RegisterPrinter

RegisterPrinter is an alias for core impl

Functions

func Start

func Start(cfg api.Config)

Start runs the application is one of the modes: - local evaluate a script from file - http service + REPL - http client + REPL

Types

This section is empty.

Directories

Path Synopsis
cmd
repl Module
plugins
fs

Jump to

Keyboard shortcuts

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