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.22
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 }
]
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.