NSS Scripting
NSS Scripting (NSS Script) is a platform-independent scripting language, running on the Java Virtual Machine, that serves the same role as Bash, Cmd, or PowerShell: writing small, executable scripts to automate common tasks. Unlike those shell languages, NSScript scripts run identically across operating systemsSystemA set of interconnected components that work together to achieve a specific purpose or function.: a script that works on Windows runs the same way on Ubuntu or macOS.
NSS Script is based on the Kotlin language. Since Kotlin scripts run on the JVM, a large portion of the Kotlin API and the Java API are available for use in scripts. On top of this, NS provides a DSL (a set of purpose-built functions) to carry out common NS development tasks with minimal code.
A script is a file with the .nss extension. As with any executable text file on a Unix systemSystemA set of interconnected components that work together to achieve a specific purpose or function., a
shebang sequence can be used to define the script's interpreter;
on Windows, this line is simply ignored when the script runs.
NS DSL design
The NS-specific API is built from higher-order functions, falling into two categories:
- Scope functions change the context available within them to the code inside their scope. They provide different or additional fieldsFieldA property of a DataElement expanded to a database column and user interface input element., or different functionality.
- Execution functions are builders: they collect arguments supplied to them and use those to execute a task once their scope has run.