Quickstart
How to get Sprig up and running by building the executable
Setting up Sprig is straight forward. Let's get it working on your machine:
You'll need to have the following installed on your machine:
node: the runtime Sprig works in
npm: to install dependencies
pkg: to package Sprig into an executable
Once you've installed the above dependencies, you're ready to get started.
Clone the repo and install the dependencies:
Use the following command to build the Sprig executable - this compiles and packages sprig into the bin
folder:
You can use the executable you just created directly from the bin
folder (or wherever you choose to move it to). But it's preferable to install the compiled executable globally so you can call sprig
from anywhere:
If you want to build and install Sprig in one go, you can use this script:
That's it! You should now have a fully functional Sprig executable ready to go.
Your first Sprig program
What kind of programming guide would this be if it didn't include a Hello World example? Let's write your first Sprig program and run it using the executable we just built.
Create a file called hello.sp
and write the following Sprig code inside of it:
To run the above program, simply run this command in your terminal (assuming you've followed the step to install Sprig globally, and that you're in the directory of the hello.sp
file):
You should see the following output:
A deeper look at Sprig features
Head over to the next section to get an understanding of Sprig basics and what features are available for you to play around with.
Last updated