Docs/Automation

Automation

Standard library

Use files, paths, processes, JSON, HTTP, terminal input and clocks.

About 15 minVersion: 0.10.1

Globals and explicit imports

Standard modules are available as runtime globals. You can also import individual members from std:module when a narrower dependency is easier to read.

standard.orvi
1import { read_text } from "std:fs"2import { join } from "std:path"34fn load_manifest() -> Result<string, string> {5    let file = join([context.project_dir, "orvi.toml"])6    return read_text(file)7}89print(load_manifest())

Files and paths

fs.read_textRead a UTF-8 file.
fn read_text(path: string) -> Result<string, string>
fs.write_textWrite a UTF-8 file.
fn write_text(path: string, contents: string) -> Result<void, string>
fs.existsCheck whether a path exists.
fn exists(path: string) -> bool
path.joinJoin path components using the platform separator.
fn join(parts: list<string>) -> string

Environment, processes and JSON

env.getRead an environment variable.
fn get(name: string) -> Option<string>
process.runRun a process directly, without a shell.
fn run(program: string, args: list<string>) -> Result<map<any>, string>
terminal.confirmAsk an interactive yes or no question.
fn confirm(prompt: string) -> Result<bool, string>
json.parseParse JSON text.
fn parse(text: string) -> Result<any, string>

HTTP and time

http.getPerform a bounded HTTP GET request.
fn get(url: string) -> Result<map<any>, string>
http.requestPerform a bounded HTTP request.
fn request(method: string, url: string, headers: map<string>, body: string) -> Result<map<any>, string>
time.unix_msRead Unix time in milliseconds.
fn unix_ms() -> Result<int, string>
time.sleep_asyncWait without blocking the async executor.
fn sleep_async(milliseconds: int) -> Future<Result<void, string>>