ela
Contents

ManualLanguage

Commands

In the terminalela --spec commands

  • Commands are typed bare, as in Bash: git status runs.
  • A bare command runs and waits for completion.
  • Outside quotes, \ makes the next character itself, as in Bash: echo c\*.txt passes c*.txt, and ls \.h* lists the hidden files whose names start with h (PACKAGES.md, Paths and directories, for globs).
  • echo is ela's own: it writes its words a space apart and a newline, which -n leaves out, with no process started. It has no -e, since a string in double quotes holds its escapes already: echo "name\tsize". It takes redirects and stands in a pipeline as any command does, and warn writes the same to stderr (SHELL.md, Built-ins). There is no print, which --lint warns of, as mailcap's print program opens a file to print it; printf is the system's program. To stop the script with a message, fail "no config in $dir" writes it to stderr and exits 1 (fail).
echo "deploying $host"echo -n "waiting... "echo "$name\t$size" >> report.tsvecho $text | sha256sum

echo prints any value #

echo prints a list, a map, a struct or a table as well as text, numbers and booleans, in ela's own form, the one a value typed alone at the prompt prints in, so what it prints can be pasted back into a script. Text inside a value is quoted, so "1" and 1 differ.

  • A value stays on one line when it fits the width: the terminal's when echo writes to it alone, else 100 columns, into a file, a pipe or a $( ), so a script writes the same file every time. Past it, a list or a map breaks one item a line, indented four spaces, each item laid out by the same rule.
  • A value is never cut: a list of 9,800 paths prints all 9,800, as cat prints a big file. A value typed alone at the prompt prints the same way.
  • A list prints its form too, ["ela", "amber-lib"], so echo $x never depends on what kind of value x holds. Every other command still takes a list's items as its arguments, and str.join makes the words: echo ${str.join($names, " ")}. ela --lint points echo $l of a list it knows to str.join.
  • A table prints as aligned columns under a header row of its names.
  • A word that starts with a name or a package's pkg.name glued to ( is a call, its value printed as echo $x prints one: echo len($hosts), echo list.head($hosts, 2), echo plan($target). ela's call parser reads it to its matching ), spaces, commas and lines inside, and checks it before line 1 as any call: a name no proc has is no proc named …. An index or a field glued to the ) is the call's, echo list.head($hosts, 2)[0], and text glued after it is the word's, echo len($done)%. After the call, echo's words go on as always: echo len($hosts) + 1 prints 3 + 1. Only echo reads a word as a call: warn and every other command take their words as text, and a call in one is ${len($hosts)}. A $( ) runs a command, and a call is none, so echo $(len($hosts)) is an error that names echo len($hosts).
  • Only echo takes a map: any other command still refuses one, and text joined with a map, "got $m", is still an error. json.encode and the other data packages' encode make text in a format.
names = ["ela", "amber-lib"]echo $names                                # ["ela", "amber-lib"]echo ${str.join($names, " ")}              # ela amber-libls $names                                  # ls ela amber-libecho len($names)                           # 2echo "deps:" list.head($names, 1) "first"  # deps: ["ela"] firstsmall = {"name": "ela", "size": 1204}echo $small                                # {"name": "ela", "size": 1204}echo map.keys($small) > keys.txt           # ["name", "size"] into keys.txt
{    "name": "ela",    "deps": ["amber-lib", "amber-json", "amber-toml", "odin-web"],    "paths": {"build": "/home/ada/ela/build", "dist": "/home/ada/ela/dist"},}