A terminal whose keys come from a list and whose output is kept as text.
Events are handed out in order, and :closed once they run out. Only committed
frames and printed text are kept; frames drawn on the way are dropped, so the
transcript does not depend on timing.
terminal = Drafter.Prompt.Terminal.Scripted.start([{:key, :y}])
{{:key, :y}, terminal} = Drafter.Prompt.Terminal.next_event(terminal, :infinity)
{:closed, _terminal} = Drafter.Prompt.Terminal.next_event(terminal, :infinity)
Drafter.Prompt.Terminal.Scripted.stop(terminal)The terminal is a process, so it can be used from any process and by several
prompts in a row. Drafter.Prompt.Script wraps it for tests.
Options
:size-{columns, rows}reported to prompts. Default{80, 24}.
Summary
Functions
The events not yet handed out.
Start a terminal that will hand out events.
Stop the terminal's process.
Everything committed and printed so far, as plain text.
Types
@type t() :: %Drafter.Prompt.Terminal.Scripted{ size: {pos_integer(), pos_integer()}, store: pid() }
Functions
@spec remaining(t()) :: [Drafter.Prompt.Terminal.event()]
The events not yet handed out.
@spec start( [Drafter.Prompt.Terminal.event()], keyword() ) :: t()
Start a terminal that will hand out events.
@spec stop(t()) :: :ok
Stop the terminal's process.
Everything committed and printed so far, as plain text.