REPL
The repl command starts an interactive FQL shell where you can type expressions and see results immediately.
terminal
ferret repl
The shell prints a version banner and presents a > prompt:
Welcome to Ferret REPL v2.0.0-alpha.44
Please use `exit` or `Ctrl-D` to exit this program.
>
Evaluate expressions
Type any FQL expression at the prompt. The result prints as soon as evaluation finishes:
> return 1 + 2
3
> return { name: "Ada", active: true }
{"active":true,"name":"Ada"}
Multi-line input
For scripts that span multiple lines, start a block with %, type the lines, then close with % to submit:
> %
let users = [
{ name: "Ada", active: true },
{ name: "Grace", active: false }
]
return for user in users
filter user.active
return user.name
%
["Ada"]
Pass parameters
Use the --param flag to pass values into REPL queries. Parameters are accessible as @name:
terminal
ferret repl --param greeting=hello
> return @greeting
"hello"
The --param flag follows the same format as the run command.
Runtime and browser flags
The REPL accepts the same runtime and browser flags as ferret run. For example, to start a REPL with a headless browser available:
terminal
ferret repl --browser-headless
Exit
Type exit or press Ctrl-D to leave the REPL.