class Opal::Asciicast::Driver

Overview

Headless terminal driver that records all screen output directly into an Asciinema v2 recording (.cast) stream. Allows any Opal application, TEA program, form wizard, or interactive UI to be driven and recorded headlessly.

Defined in:

opal/asciicast/driver.cr

Constructors

Instance Method Summary

Instance methods inherited from class Opal::Terminal::Driver

check_resize : ResizeEvent | Nil check_resize, clear : Nil clear, disable_mouse : Nil disable_mouse, enable_mouse : Nil enable_mouse, enter_alternate_screen : Nil enter_alternate_screen, exit_alternate_screen : Nil exit_alternate_screen, flush : Nil flush, flush_input : Nil flush_input, hide_cursor : Nil hide_cursor, input : IO input, input=(input : IO) input=, move_to(row : Int32, col : Int32) : Nil move_to, on_resize : Proc(Int32, Int32, Nil) | Nil on_resize, on_resize=(on_resize : Proc(Int32, Int32, Nil) | Nil) on_resize=, output : IO output, output=(output : IO) output=, poll_event(timeout_ms : Int32 = 0) : KeyEvent | MouseEvent | ResizeEvent | Nil poll_event, raw_mode(&) raw_mode, read_event : KeyEvent | MouseEvent | ResizeEvent | Nil read_event, show_cursor : Nil show_cursor, size : Tuple(Int32, Int32) size, write(str : String) : Nil write

Constructor methods inherited from class Opal::Terminal::Driver

new(output : IO = STDOUT, input : IO = STDIN) new

Constructor Detail

def self.new(width : Int32 = 80, height : Int32 = 24, title : String = "Opal Session", writer : Writer | Nil = nil, time_advance : Float64 = 0.05) #

[View source]

Instance Method Detail


[View source]
def event_queue=(event_queue : Array(Terminal::KeyEvent | Terminal::MouseEvent | Terminal::ResizeEvent)) #

[View source]
def flush : Nil #

[View source]
def in_raw_mode? : Bool #

[View source]
def inject_event(event : Terminal::KeyEvent | Terminal::MouseEvent | Terminal::ResizeEvent) : self #

Injects a keyboard or mouse event into the driver's input stream


[View source]
def inject_key(name : String, char : Char | Nil = nil, ctrl : Bool = false, alt : Bool = false, shift : Bool = false) : self #

Convenience helper: injects a keyboard event


[View source]
def inject_mouse(x : Int32, y : Int32, button : Terminal::MouseButton = Terminal::MouseButton::Left, action : Terminal::MouseAction = Terminal::MouseAction::Press) : self #

Convenience helper: injects a mouse event


[View source]
def pause(seconds : Float64) : self #

Pauses recording timeline


[View source]
def poll_event(timeout_ms : Int32 = 0) : Terminal::KeyEvent | Terminal::MouseEvent | Terminal::ResizeEvent | Nil #
Description copied from class Opal::Terminal::Driver

Non-blocking or timed check for input/resize events.


[View source]
def raw_mode(&) #

Simulates entering raw mode


[View source]

Reads the next simulated or injected input event


[View source]
def save(filename : String) : Nil #

Saves the recorded session to a .cast file


[View source]
def size : Tuple(Int32, Int32) #

Terminal dimensions from writer header


[View source]
def time_advance : Float64 #

[View source]
def time_advance=(time_advance : Float64) #

[View source]
def to_s(io : IO) : Nil #

Returns the complete recorded asciicast content


[View source]
def to_s : String #
Description copied from class Object

Returns a nicely readable and concise string representation of this object, typically intended for users.

This method should usually not be overridden. It delegates to #to_s(IO) which can be overridden for custom implementations.

Also see #inspect.


[View source]
def write(str : String) : Nil #

Records an output chunk to the asciicast timeline


[View source]
def writer : Writer #

[View source]