nest doesn't compile anything. It downloads packages from the index and writes them into your project's nest.toml; tori run and tori bld read nest.toml themselves and find the packages for use.
$ nest new hello && cd hello
nest: project hello/ — run it: cd hello && tori run src/main.tr
$ nest install math
nest: downloading the package index — https://github.com/torilang/tori-index
nest: math 0.1.0, by torilang — downloaded: ~/.tori/packs/math
nest: math = "~/.tori/packs/math/src" in nest.toml
$ tori run src/main.truse math
fn main() {
say(math.pow(2, 10), " ", math.isqrt(1000), " ", math.gcd(84, 36))
}
Download nest (Linux x86-64) or nest.exe (Windows x64) from the latest release and put it next to tori on your PATH. nest uses git to download packages, so git must be installed (Git for Windows on Windows).
| Command | What it does |
|---|---|
nest new name |
a new project: name/nest.toml and name/src/main.tr |
nest install package |
download the package into ~/.tori/packs (or check it for updates) and add it to nest.toml |
nest install package --local |
copy the package into the project (./package/) so you can edit it |
nest install |
download everything listed in nest.toml, e.g. after cloning a project |
nest remove package |
remove the package from nest.toml |
nest list |
the project's dependencies, their versions, and what isn't downloaded yet |
-y |
update without asking |
Short forms: nest i / add, nest rm, nest ls.
When a package's code changes in the index, nest install asks before updating:
nest: the source code of package math has changed. Update? [Y/n]
[package]
name = "hello"
version = "0.1.0"
[deps]
math = "~/.tori/packs/math/src" # a global package
vec = "vec" # a local copy: ./vec[deps] is exactly what tori reads: name = "folder" is the same as --pkg=name=folder. ~/ is $HOME on Linux and %USERPROFILE% on Windows, so the same nest.toml works on both. A package can have its own nest.toml; its dependencies are downloaded and resolved too.
Everything downloaded lives in ~/.tori: index/ (a clone of the index), packs/ (packages), git/ (packages that live in their own repositories). Set NEST_INDEX to use another index — a mirror, a company index or a local folder.
Fork tori-index, add a folder named after your package with a pack.toml and the code (or just a pack.toml with git = "https://…"), and open a pull request. Details: Packages: nest.
nest is a Tori program of four modules:
| File | What it does |
|---|---|
nest.tr |
the commands: new, install, remove, list |
conf.tr |
reading and editing pack.toml and nest.toml |
plat.tr |
everything OS-specific: files, folders, environment, running git (@sys on Linux, @win on Windows) |
txt.tr |
memory and strings |
tori bld nest.tr # nest
tori bld nest.tr --os=win # nest.exe