Package-level declarations

This package contains all essentials and common functionality for scripting.

Types

Link copied to clipboard

This interface is implemented by all classes that represent a dedicated scope of a script that deals with a specific tool or functionality.

Link copied to clipboard

This interface is implemented by all classes that serve as builders for an execution of some operation. For every implementation of a template, there is typically an accompanying function that will allow for template argument functions to be called within the scope of the template instance object.

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FILE])
annotation class Import(val paths: String)

A file annotation to import one or more scripts into the current script.

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FILE])
annotation class MinVersion(val version: String)

A file annotation to require a minimum version of NSScript. Script compilation will fail if the version requested is greater than the version of the engine.

Link copied to clipboard
abstract class NSScript(val ctx: ScopeContext) : ScriptScope

The base class which is extended by the script engine to execute an NSScript in. This class is also the root ScriptScope and provides the ScopeContext object where ScopeContext.path is the current directory from where the script was executed.

Link copied to clipboard

Exception used to wrap and more easily trace exceptions that occur in the API. This exception is handled and unwrapped by the script engine, so it should not be used in scripts.

Link copied to clipboard
annotation class NSScriptDsl

Annotation to indicate what classes are part of the script DSL. This forced functions of those classes to be used in direct receiver scopes.

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FILE])
annotation class RootPath(val config: String)

A file annotation that can define a configuration for the value of net.democritus.scripting.context.ScopeContext.path at the root level of the script. This refers to the value of ctx.path.

Link copied to clipboard
sealed interface RootScope

This interface is the root of all scopes that can be used in a script.

Link copied to clipboard

This interface is implemented by all classes that represents the scope of a script.

Link copied to clipboard
interface Settings

This interface is implemented by classes that provide access to settings for scripts in the form of key-value pairs. The settings provided are mostly retrieved from properties files that can be used to specify global settings for NSScript.

Functions

Link copied to clipboard
fun env(name: String): String?

Alias of System.getenv to retrieve the value of an environment variable.

Link copied to clipboard
fun exit(exitCode: Int): Nothing

Alias of exitProcess to kill the script engine process with a given exitCode.