Skip to content

pdvcs/stardust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stardust

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.

Features

  • 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.

Project Structure

  • 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, and console for more information.
  • resources/: Contains test scripts, samples, and documentation.

Built-in Functions

Detailed documentation for built-in functions can be found in the resources/modules/docs/ directory. See resources/samples for example scripts.

Usage

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.star

To 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.

About

An embedded interpreter for Go projects

Resources

License

Stars

Watchers

Forks

Contributors