mix logos.run (Logos v0.2.0)

Copy Markdown

Runs a Logos script file or an inline expression: builds a fresh Runtime, evaluates the source as a top-level form sequence, and exits with a status reflecting success or failure.

Usage

mix logos.run path/to/script.logos [arg1 arg2 ...]
mix logos.run -e "(+ 1 2)" [arg1 arg2 ...]

Any arguments after the script path (or after the -e expression) are made available to the running script as (system-argv), a Logos.Vector of strings -- mirroring Elixir's System.argv().

Exits 0 on success, 1 if the script errors (the error is printed to stderr first) or the given path can't be read.

Summary

Functions

The testable core, separated from run/1's System.halt/1 exit-status side effect so it can be exercised directly in tests without halting the test VM. Builds a fresh Logos.Runtime, sets (system-argv) to script_argv, and evaluates source as a top-level form sequence.

Functions

run_source(source, script_argv \\ [])

@spec run_source(String.t(), [String.t()]) :: {:ok, term()} | {:error, term()}

The testable core, separated from run/1's System.halt/1 exit-status side effect so it can be exercised directly in tests without halting the test VM. Builds a fresh Logos.Runtime, sets (system-argv) to script_argv, and evaluates source as a top-level form sequence.