LocalCommandContext class
Runtime context passed to a LocalCommand.
Exposes the connected client, the target node's metadata, the live session and a line-oriented output sink. Commands call requestExit to end the interactive session.
Constructors
-
LocalCommandContext({required ClientRuntime client, required NodeDescriptor node, required DateTime startedAt, required void writeLine(String line), Principal? principal, RemoteSession? session, Clock clock = const SystemClock(), Future<
String> readLine(String prompt)?, String? currentRemoteCwd()?, void printAbove(String line)?}) - Creates a command context.
Properties
- client → ClientRuntime
-
The connected client runtime.
final
- clock → Clock
-
The clock used for duration/latency reporting.
final
- currentRemoteCwd → String? Function()?
-
Returns the current remote working directory, if known, so commands can
resolve relative remote paths.
nullwhen unavailable.final - detachRequested → bool
-
Whether a command detached the session (the remote shell keeps running).
When set, the host must drop the connection without closing the session.
no setter
- exitRequested → bool
-
Whether a command requested the session to end.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- node → NodeDescriptor
-
The node the session is attached to.
final
- principal → Principal?
-
The authenticated principal, if known.
final
- printAbove → void Function(String line)?
-
Emits a line of asynchronous/background output without disturbing the
active input line (e.g. a background
:drive watchreporting a sync).nullwhen the host cannot repaint around output; callers then fall back to writeLine.final -
readLine
→ Future<
String> Function(String prompt)? -
Reads a line of user input after writing
prompt;nullwhen the host cannot prompt (commands then assume a non-interactive default).final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- session → RemoteSession?
-
The active interactive session, if one is open.
final
- startedAt → DateTime
-
When the interactive session started.
final
- writeLine → void Function(String line)
-
Writes a line of output back to the user.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
requestDetach(
) → void - Requests that the host leave the interactive session because it was detached: the connection should be dropped but the session left running.
-
requestExit(
) → void - Requests that the interactive session terminate (closing the remote shell).
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited