loom & weft
Made for Swift.

Unreleased APIs from PR #2. Not in 0.2.1. Stable 0.2.1 reference.

LOOM Unreleased (PR #2) / SUPPORTING WEFT TYPES

TerminalCommand

Lower-level terminal commands supplied by weft. Add the weft product and import weft to refer to this type by name. ANSI byte generation does not open a session or write the bytes itself.

Defined by weft, with no loom typealias. Add the weft product to your target and use import weft when referring to this type by name.

Standard inherited Swift protocol operations such as synthesized equality and OptionSet set operations are not repeated. The public declarations below are extracted from the exact source revision listed in the coverage manifest.

Example

let command = TerminalCommand.moveCursor(Point(x: 0, y: 0))
_ = command.escapeSequence
Members on this page

Feature guides and release status

TerminalCommand

Enumeration
enum TerminalCommand

Conforms to: Swift.Equatable, Swift.Sendable, Swift.SendableMetatype.

Terminal controls usable without a renderer.

Coordinates are zero-based cells.

Source · TerminalCommand.swift:6

moveCursor(_:)

Case
case moveCursor(Point)

The move cursor case. Associated values, if any, are shown in the declaration.

Source · TerminalCommand.swift:7

clearScreen

Case
case clearScreen

Clears the display and moves the cursor home; does not clear scrollback.

Source · TerminalCommand.swift:8

clearLine

Case
case clearLine

Clears the entire current terminal line.

Source · TerminalCommand.swift:9

cursorVisible(_:)

Case
case cursorVisible(Bool)

The cursor visible case. Associated values, if any, are shown in the declaration.

Source · TerminalCommand.swift:10

resetStyle

Case
case resetStyle

Resets terminal text styling to conventional defaults.

Source · TerminalCommand.swift:11

escapeSequence

Instance Property
var escapeSequence: String { get }

Returns ANSI control bytes as a String. Cursor coordinates are translated from zero-based cells to ANSI’s one-based coordinates.

Source · TerminalCommand.swift:13