D4rtCliController class
Implementation of D4rtCliApi that handles all CLI operations.
This controller is Console-independent and can be used for:
- Interactive REPL (via D4rtReplBase wrapper)
- Script automation (via cli global)
- Testing (without terminal dependencies)
- Implemented types
Constructors
- D4rtCliController({required D4rt d4rt, required CliState state, required String toolName, CliRuntime? runtime})
- Creates a CLI controller.
Properties
- configuration → D4rtConfiguration
-
Get the D4rt bridge configuration.
no setteroverride
- currentSessionId → String?
-
Current session ID, or null if no session active.
no setteroverride
- d4rt → D4rt
-
The underlying D4rt interpreter.
no setteroverride
- dataDirectory → String
-
The data directory (~/.tom/d4rt or ~/.tom/dcli).
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- isMultilineMode → bool
-
Check if currently in multiline mode.
no setteroverride
-
multilineBuffer
→ List<
String> -
Get the current multiline buffer contents.
no setteroverride
- multilineMode → MultilineMode
-
Get the current multiline mode type.
no setteroverride
- runtime → CliRuntime
-
Access process and platform runtime information.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- toolName → String
-
The tool name (e.g., 'D4rt', 'DCLI').
no setteroverride
Methods
-
cd(
String path) → String -
Change current directory.
Maps to:
cd <path>override -
classes(
) → List< ClassInfo> -
List classes in current environment.
Maps to:
classesoverride -
clear(
) → void -
Clear the screen.
Maps to:
clearNote: No-op in headless/API mode.override -
clearMultilineBuffer(
) → void -
Clear multiline buffer without executing.
override
-
closeSession(
) → void -
Close the current session.
override
-
cwd(
) → String -
Show current working directory.
Maps to:
cwdoverride -
define(
String name, String template) → void -
Create a command alias.
Maps to:
define <name>=<template>override -
defines(
) → Map< String, String> -
List all defines.
Maps to:
definesoverride -
end(
) → Future -
End multiline input and execute.
Maps to:
.endoverride -
enums(
) → List< EnumInfo> -
List enums in current environment.
Maps to:
enumsoverride -
eval(
String expression) → Future -
Evaluate an expression and return the result.
override
-
execute(
String source, {String? basePath}) → Future< ExecuteResult> -
Execute source code as a fresh program.
Maps to:
.execute <path>(when given source) or D4rt.execute()override -
executeContinued(
String source, {String? basePath}) → Future< ExecuteResult> -
Execute source code in the current environment (continued).
Maps to D4rt.continuedExecute()
override
-
executeFile(
String path) → Future< ExecuteResult> -
Execute a file as a fresh program.
Maps to:
.execute <path>override -
executes(
) → List< String> -
List executable files (*.d4rt.dart).
Maps to:
executesoverride -
expandDefine(
String input) → String? -
Expand a define invocation string (e.g., "@greet World").
Returns null if input doesn't match any define.
override
-
file(
String path) → Future< ExecuteResult> -
Execute file in current environment.
Maps to:
.file <path>override -
help(
) → String -
Show detailed help text.
Maps to:
helpoverride -
home(
) → String -
Return to data directory (~/.tom/d4rt or ~/.tom/dcli).
Maps to:
homeoverride -
imports(
) → List< ImportInfo> -
Show imports in current environment.
Maps to:
importsoverride -
info(
[String? name]) → SymbolInfo? -
Show details and suggestions for a symbol.
Maps to:
info [name]override -
invokeDefine(
String name, [List< String> ? args]) → String? -
Invoke a define with arguments.
Maps to:
@<name> [args]override -
load(
String path) → Future< int> -
Replay file with output.
Maps to:
.load <path>override -
loadDefines(
String path) → int -
Load defines from a file.
Maps to:
.load-defines <path>override -
loadFile(
String path) → String -
Load file contents (*.exec.dart).
Replaces:
.print-file <path>override -
loadReplay(
String path) → String -
Load replay contents (*.replay.txt).
Replaces:
.print-replay <path>override -
loadScript(
String path) → String -
Load script contents (*.script.txt).
Replaces:
.print-script <path>override -
loadSession(
String sessionId) → String -
Load session contents (*.session.txt).
Replaces:
.print-session <name>override -
ls(
[String? path]) → List< String> -
List all files in current (or specified) directory.
Maps to:
lsoverride -
methods(
) → List< FunctionInfo> -
List methods/functions in current environment.
Maps to:
methodsoverride -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
plays(
) → List< String> -
List replay files (*.d4rt for D4rt, *.dcli for DCli).
Maps to:
playsoverride -
processPrompt(
String line) → Future -
Process a command line as if entered interactively.
override
-
processPrompts(
List< String> lines, {bool continueOnError = false}) → Future<List> -
Process multiple prompts in sequence.
override
-
registeredClasses(
) → List< ClassInfo> -
List registered bridge classes.
Maps to:
registered-classesoverride -
registeredEnums(
) → List< EnumInfo> -
List registered bridge enums.
Maps to:
registered-enumsoverride -
registeredImports(
) → List< ImportInfo> -
List registered bridge imports.
Maps to:
registered-importsoverride -
registeredMethods(
) → List< FunctionInfo> -
List registered bridge methods.
Maps to:
registered-methodsoverride -
registeredVariables(
) → List< VariableInfo> -
List registered bridge variables.
Maps to:
registered-variablesoverride -
replay(
String path) → Future< int> -
Replay file silently.
Maps to:
.replay <path>override -
reset(
{String? replayPath}) → Future< void> -
Reset environment, optionally replay session/file.
Maps to:
.reset [name]override -
script(
String path) → Future< int> -
Load file line-by-line as script.
Maps to:
.script <path>override -
scripts(
) → List< String> -
List script files (*.script.txt).
Maps to:
scriptsoverride -
session(
String sessionId) → Future< void> -
Switch to a session.
Maps to:
.session <name>override -
sessions(
) → List< String> -
List session IDs.
Maps to:
sessionsoverride -
showInit(
) → String -
Show initialization source.
Maps to:
show-initoverride -
startDefine(
) → void -
Start multiline define mode (functions/classes persist).
Maps to:
.start-defineoverride -
startExecute(
) → void -
Start multiline execute mode (run as fresh program).
Maps to:
.start-executeoverride -
startFile(
) → void -
Start multiline file mode (run as file in current environment).
Maps to:
.start-fileoverride -
startScript(
) → void -
Start multiline script mode (run code block with return value).
Maps to:
.start-scriptoverride -
toString(
) → String -
A string representation of this object.
inherited
-
undefine(
String name) → bool -
Remove a command alias.
Maps to:
undefine <name>override -
variables(
) → List< VariableInfo> -
List variables in current environment.
Maps to:
variablesoverride
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited