The manual
Everything ela does, in its own words.
The language, its packages, the shell, the editors and the agent guide, one page per section. It is the text the binary carries: ela --spec jobs in a terminal prints the part this site has at /docs/jobs/.
Asking at the terminal
A deploy that asks where to with ask.choose and whether to go on with ask.yes, on the terminal's other screen inside with screen, so the questions leave nothing behind; spin shows a spinner while each slow step runs. --yes and a target answer ahead, where no one is there to ask. See Asking the user in the manual.
# deploy.ela: build, ask where to and whether to go on,# then ship.# Run as: ela deploy.ela, or ela deploy.ela --yes staging# from cron or CI TARGETS :: ["staging", "production"] # A spinner while it builds; the output is held back, and# shown in full only if the build fails.spin "building" make dist # The answers given ahead, or asked on the terminal's other# screen, which end with gives back.if len($args) == 2 and $args[0] == "--yes" target = $args[1] if not has($TARGETS, $target) names = str.join($TARGETS, ", ") fail "no target $target: $names" end if go = trueelse with screen target = ask.choose("Deploy to?", $TARGETS) go = ask.yes("Deploy to $target now?") end withend ifif not $go; echo "nothing deployed"; exit 0 # One spinner and one time for the lines of the block.spin "deploying to $target" rsync -a dist/ deploy@${target}.example:/srv/app/ ssh deploy@${target}.example sudo systemctl restart append spinecho "deployed to $target"An API's answer as a table
An API's JSON made into a table in one call: at names the path to the rows, columns the path to each column's value, types makes text a number and fallback stands in for a missing key. table.sort and table.filter then give the open orders, largest first. See Tables from JSON, YAML, TOML and CSV in the manual.
# orders.ela: the open orders in an API's answer,# largest first.# Run as: ela orders.ela orders.json FILE :: $args[0] # One call from the JSON text to a table: the rows are at# data.orders, and each column names the path to its value.# A total comes as text, which types makes a number; an# order with no city takes the fallback.orders = json.table(file.read($FILE), at = "data.orders", columns = {"id": "id", "status": "status", "total": "total", "name": "customer.name", "city": "customer.city"}, types = {"total": Type.NUMBER}, fallback = {"city": "unknown"}) # The largest first, then the open ones over 50,# in that order.proc over_50(row) -> (keep: bool); return $row["total"] > 50 by_total = table.sort($orders, by = "total", desc = true)open = table.filter($by_total, where = {"status": "open"}, keep = over_50) for row in $open echo "$row['id'] $row['name'], \ $row['city']: $row['total']"end forecho "$open.rows of $orders.rows orders open over 50"