The ela package
In the terminalela --spec the-ela-package
What the binary says about ela, for a script or the prompt to use as data: each proc gives what
the option it is named after gives (SHELL.md, Binary), from the same code.
| Built-in | Does |
|---|---|
ela.spec(topic = "") | Returns the spec's section for the topic as a string, as ela --spec topic prints it |
ela.spec() | Returns the topics as a list of strings; ela.spec("") does the same |
ela.explain(message) | Returns the rule behind an error message as a map: rule, why, wrong, right, spec |
ela.builtins() | Returns every built-in as a list of maps, as ela --builtins --json: name, kind, call, params, does |
ela.lint(path) | Returns what ela --lint finds in the script as a list of maps, line, col, severity, message; empty when there is nothing |
ela.fmt(text) | Returns the script text laid out as ela --fmt lays a file out (LANGUAGE.md, Layout); text that does not parse is an error that gives the line and column |
ela.doctor() | Returns the doctor's checks as a map, as ela --doctor --json: status, and checks, each with check, result, message |
ela.version() | Returns the build as a map: version, rev, built, platform |
ela.commands(line) | Returns every command a shell line would run, as ela --agent commands --json lists them: a map of ok, ela, problems and commands (AGENT.md, Commands a line runs) |
for f in ela.lint("deploy.ela") if $f["severity"] == "error" e = ela.explain($f["message"]) echo "line $f['line']: $e['rule']" end ifend for
ela.explain'sspecis the topic, soela.spec($e["spec"])is the section;wrongandrightare""for an entry with no example. A message that wraps another, asjson.decode: ...does, gives the entry of the message inside it asinner, a map of the same keys. A message ela does not give is an error that says so.- An unknown topic, and a file
ela.lintcan't read, are errors. A finding is data, not an error: the call succeeds, and the findings say what is wrong. ela.doctor()runs nothing frominit.ela, asela --doctordoes not; itsstatusis the codeela --doctorwould exit with.elais a built-in package name, so an import can't take it:import ela "tools.ela"is an error. A command line starting with the wordelastill runs the program.