Command-line LaiRu
LaiRu source can be run from a shell for maintenance tasks, diagnostics, and scripts.
Target
Signature
1lairu run path/to/script.lassoLaiRu source can be run from a shell for maintenance tasks, diagnostics, and scripts.
Command-line LaiRu is a guide page for a common LaiRu workflow. Command-line LaiRu appears in project setup, source loading, or packaging code. Keep paths explicit, load reusable definitions once, and choose template mode only when literal output is part of the file.
Examples
Basic call
1stdoutnl('maintenance task')The example shows the normal call shape. Adapt variable names, validation, and surrounding error handling to the context.
Run a maintenance script
1// maintenance.lasso2stdoutnl('starting')3local(total) = array(1, 2, 3)->sum4stdoutnl('total=' + #total)Run raw source with `lairu run maintenance.lasso`. Use stdout helpers for command-line output.
Evaluate a short expression
1math_add(20, 22)Run the same expression from a shell with `lairu eval "math_add(20, 22)"` when you want a quick runtime check.
Render a template file
1<h1>Report for [date->format('%Y-%m-%d')]</h1>2<p><?= math_add(20, 22) ?></p>Save this as `./views/report.lasso` and render it from a shell with `lairu render ./views/report.lasso`.