@Incubating
public static final class GroovyshOptions.Builder
extends Object
Builder for GroovyshOptions.
| Type Params | Return Type | Name and description |
|---|---|---|
|
public GroovyshOptions.Builder |
binding(String name, Object value)Adds a single binding variable. |
|
public GroovyshOptions.Builder |
bindings(Map<String, ?> bindings)Replaces the binding variables that will be installed on the engine. |
|
public GroovyshOptions |
build()Builds an immutable options object. |
|
public GroovyshOptions.Builder |
compilerConfiguration(CompilerConfiguration compilerConfiguration)Sets the compiler configuration used when no engine(GroovyEngine) is supplied. |
|
public GroovyshOptions.Builder |
engine(GroovyEngine engine)Supplies a pre-built engine. |
|
public GroovyshOptions.Builder |
errorHandler(GroovyshOptions.ErrorHandler errorHandler)Sets the error handler. |
|
public GroovyshOptions.Builder |
groups(CommandGroup groups)Appends command groups. |
|
public GroovyshOptions.Builder |
groups(Iterable<? extends org.jline.shell.CommandGroup> groups)Appends command groups. |
|
public GroovyshOptions.Builder |
historyFile(Path historyFile)Sets the history file. |
|
public GroovyshOptions.Builder |
onReaderReady(Consumer<org.jline.reader.LineReader> onReaderReady)Registers a callback invoked once the reader is wired, immediately before the REPL starts. |
|
public GroovyshOptions.Builder |
onReaderReady(BiConsumer<org.jline.reader.LineReader, GroovySystemRegistry> onReaderReady)Registers a callback invoked once the reader and the command registry are both wired, immediately before the REPL starts. |
|
public GroovyshOptions.Builder |
prompt(String prompt)Sets a fixed prompt. |
|
public GroovyshOptions.Builder |
prompt(Supplier<String> prompt)Sets the prompt supplier, called once per REPL iteration. |
|
public GroovyshOptions.Builder |
resultHandler(GroovyshOptions.ResultHandler resultHandler)Sets the result handler. |
|
public GroovyshOptions.Builder |
rightPrompt(String rightPrompt)Sets a fixed right-hand prompt. |
|
public GroovyshOptions.Builder |
rightPrompt(Supplier<String> rightPrompt)Sets the right-hand prompt supplier. |
|
public GroovyshOptions.Builder |
showBanner(boolean showBanner)Sets whether the groovysh banner is printed. |
|
public GroovyshOptions.Builder |
terminal(Terminal terminal)Supplies a terminal instead of letting Main build one from CLI flags. |
Adds a single binding variable.
name - variable name, must not be nullvalue - variable valueReplaces the binding variables that will be installed on the engine.
bindings - variables to install; null is treated as emptyBuilds an immutable options object.
Sets the compiler configuration used when no engine(GroovyEngine) is supplied.
compilerConfiguration - the configuration, or null for the defaultSupplies a pre-built engine. When set, compilerConfiguration(CompilerConfiguration) is not used to construct a second engine.
engine - the engineSets the error handler.
errorHandler - the handler, or null for groovysh's own trace Appends command groups. Mirrors ShellBuilder.groups(CommandGroup...).
groups - groups to append; null entries are rejectedAppends command groups.
groups - groups to append; null is ignored Sets the history file. Mirrors ShellBuilder.historyFile(Path).
historyFile - the file, or null for groovysh's own Registers a callback invoked once the reader is wired, immediately
before the REPL starts. Mirrors ShellBuilder.onReaderReady(Consumer).
onReaderReady - the callback, or null for none Registers a callback invoked once the reader and the command registry
are both wired, immediately before the REPL starts. Mirrors
ShellBuilder.onReaderReady(BiConsumer).
This is the hook for completion. groovysh has already assigned
reader.setCompleter(registry.completer()) by the time the
callback runs, so an embedder contributing its own completion wraps
that, for example
reader.setCompleter(new AggregateCompleter(registry.completer(), mine)).
Candidates from an AggregateCompleter are merged, so a
completer added this way supplements groovysh's rather than replacing
it; assign a completer of your own to replace it outright.
onReaderReady - the callback, or null for none Sets a fixed prompt. Mirrors ShellBuilder.prompt(String).
prompt - the prompt text, or null for "groovy> " Sets the prompt supplier, called once per REPL iteration.
Mirrors ShellBuilder.prompt(Supplier).
prompt - the supplier, or null for "groovy> "Sets the result handler.
resultHandler - the handler, or null for the default printer Sets a fixed right-hand prompt. Mirrors ShellBuilder.rightPrompt(String).
rightPrompt - the prompt text, or null for none Sets the right-hand prompt supplier. Mirrors ShellBuilder.rightPrompt(Supplier).
rightPrompt - the supplier, or null for noneSets whether the groovysh banner is printed.
showBanner - false to suppress the banner Supplies a terminal instead of letting Main build one from CLI flags.
Mirrors ShellBuilder.terminal(Terminal).
terminal - the terminal, or null to build the default