termlib library
Dart library that provides a set of utilities for terminal applications. Provides information about the running terminal as well as a set of methods for styling the text output or interacting with the terminal.
Classes
- BufferTermSink
- In-memory TermSink for tests. Records every write into output.
- Color
- Color class
- DeviceAttributes
- Device attributes from DA1 query.
- InteractiveTerm
- Terminal handle for interactive (tty) input.
-
KeyBinding<
A> -
Maps key specs to actions of type
A. - KeyboardFlags
- Keyboard enhancement flags.
-
Pending<
T> - Query not yet completed.
- PipedTerm
- Terminal handle for piped / redirected stdin.
-
QueryResult<
T> - Result wrapper for terminal capability queries.
- QueueOverflowEvent
-
Emitted on the broadcast
eventsstream when the queue evicts events under drop-oldest pressure. Rate-limited: between successivedequeuecalls all evictions are coalesced into a singleQueueOverflowEventcarrying the total dropped count and the type of the last evicted event. - ReadlineOptions
- Options for InteractiveTerm.readLine.
- Style
- An immutable description of terminal text appearance: colors and text attributes for a given color profile.
-
Supported<
T> - Query succeeded, value available.
- Term
- Terminal handle. Use Term.open to construct.
- TermBackend
- Transport seam between TermLib and the OS/terminal.
- TermInfo
- Terminal capability information from probeTerminal().
- TermInfoBuilder
- Builder for constructing TermInfo during probe.
- TermRunner
- Helper for setting up and tearing down terminal state.
- TermSink
- Narrow output surface termlib calls on stdout.
- Query failed or was skipped.
- WindowSize
- Window size in pixels.
Enums
- BracketedPasteStatus
- Bracketed paste status.
- Clipboard
- Clipboard to use
- ClipboardMode
- Clipboard Operation Modes
- ColorKind
- Color kind
- ColorSchemeMode
- Color scheme mode reported by terminal.
- DECRPMStatus
- DEC Report Mode status
- DeviceAttributeParams
- Device Attribute Params
- DeviceAttributeType
- Device Attribute Type
- InBandResizeStatus
- In-band window resize status.
- KeyboardEnhancement
- Keyboard enhancement level passed to InteractiveTerm.withModes.
- ProbeQuery
- Query types for terminal capability probing.
- ProfileEnum
- Enumeration representing different profiles.
- ReadlineAction
- Editing actions a key can be bound to.
- SyncUpdateStatus
- Sync update status.
- TerminalMode
-
Identifies a terminal mode tracked by
TermModes. - TextStyle
- Text Styles that can be applied to a Style object.
- Reason why a query result is unavailable.
- Underline
- Underline rendering variants for a Style.
- UnicodeCoreStatus
- Unicode Core status.
Extensions
- CursorUtils on InteractiveTerm
- Cursor handling functions
- EraseUtils on InteractiveTerm
- Eraser handling functions
- TermUtils on InteractiveTerm
- Support function that add some extra features to the terminal.
Constants
- defaultQueryTimeout → const int
- Default timeout to wait for terminal query responses.
-
seedableProbeQueries
→ const Set<
ProbeQuery> -
The ProbeQuery subset whose results seed live mode state (
TermModes): bracketed paste, in-band resize, unicode core, and keyboard capabilities. These map one-to-one to the seedableTerminalModes (seeInteractiveTerm._seedModesFromProbe). Used asTermRunner's default probe set so its build-time snapshot reflects inherited terminal state without paying for the queries that don't feed a mode.
Functions
-
probeTerminal(
InteractiveTerm term, {Set< ProbeQuery> skip = const {}, int deadline = 500}) → Future<TermInfo> - Probe terminal capabilities.
Typedefs
-
AppRunner
= FutureOr<
int> Function(InteractiveTerm term) - App runner function type. Returns exit code.
-
CleanupCallback
= FutureOr<
void> Function(InteractiveTerm term) - Cleanup callback type. Called before exit on all paths (normal, error, signal).
-
EnvironmentData
= Map<
String, String> - Platform-like environment map.
-
ErrorHandler
= FutureOr<
int> Function(InteractiveTerm term, Object error, StackTrace stack) - Error handler callback type.
-
ExitCallback
= Future<
void> Function(InteractiveTerm term, int exitCode) -
Exit callback type for testing. Replaces
flushThenExit. - Pos = ({int col, int row})
- Record that represent a coordinate position
Exceptions / Errors
- InvalidKeySpecException
- Exception thrown when an invalid key spec is provided.
- TermDisposed
-
Thrown from pending
awaitEventfutures when the queue is disposed. - TerminalNotInteractive
- Thrown when an interactive-only API is called on a piped terminal.