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: classes
override
clear() → void
Clear the screen. Maps to: clear Note: 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: cwd
override
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: defines
override
end() → Future
End multiline input and execute. Maps to: .end
override
enums() → List<EnumInfo>
List enums in current environment. Maps to: enums
override
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: executes
override
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: help
override
home() → String
Return to data directory (~/.tom/d4rt or ~/.tom/dcli). Maps to: home
override
imports() → List<ImportInfo>
Show imports in current environment. Maps to: imports
override
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: ls
override
methods() → List<FunctionInfo>
List methods/functions in current environment. Maps to: methods
override
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: plays
override
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-classes
override
registeredEnums() → List<EnumInfo>
List registered bridge enums. Maps to: registered-enums
override
registeredImports() → List<ImportInfo>
List registered bridge imports. Maps to: registered-imports
override
registeredMethods() → List<FunctionInfo>
List registered bridge methods. Maps to: registered-methods
override
registeredVariables() → List<VariableInfo>
List registered bridge variables. Maps to: registered-variables
override
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: scripts
override
session(String sessionId) → Future<void>
Switch to a session. Maps to: .session <name>
override
sessions() → List<String>
List session IDs. Maps to: sessions
override
showInit() → String
Show initialization source. Maps to: show-init
override
startDefine() → void
Start multiline define mode (functions/classes persist). Maps to: .start-define
override
startExecute() → void
Start multiline execute mode (run as fresh program). Maps to: .start-execute
override
startFile() → void
Start multiline file mode (run as file in current environment). Maps to: .start-file
override
startScript() → void
Start multiline script mode (run code block with return value). Maps to: .start-script
override
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: variables
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited