Stardust is an embedded Starlark interpreter for Go, providing both a library for integrating scripting capabilities into your applications and a standalone CLI for running Starlark scripts.
The intention is to provide the ability to write simple cross-platform (Windows, Linux, macOS) scripts, but with Python-like syntax. This is not intended to be a full-featured scripting language.
It is built on top of starlark-go.
- Some Batteries Included: Extends Starlark with modules for manipulating the filesystem, working with files, and running commands.
- Modular and Documented: Functions are arranged in namespaced modules. Documentation is generated automatically from docstrings. Automated tests exist.
- cmd/stardust/main.go: The entry point for the CLI tool
- embed/pkg.go: The entry point for the embedded interpreter
- modules/: Contains a set of built-in functions, refer to
fs,os,path,random, andconsolefor more information. - resources/: Contains test scripts, samples, and documentation.
Detailed documentation for built-in functions can be found in the resources/modules/docs/ directory. See resources/samples for example scripts.
To run this as a CLI tool, first go install it, then pass the script path as an argument to the application:
go install github.com/pdvcs/stardust/cmd/stardust@latest
stardust ./resources/samples/files.starTo embed the library in an application, import github.com/pdvcs/stardust/embed and use the Run function. See resources/examples/embed.go for an example.