The server's handle on the client's terminal — the API your CLI code calls.
Output (puts/print/warn) is fire-and-forget; input and resource ops
(gets, read_secret, file/env reads) are synchronous request/response.
Mirrors Terminalwire::V2::Server::Context.
def run(ctx) do
Terminalwire.Server.Context.puts(ctx, "Deploying…")
name = Terminalwire.Server.Context.gets(ctx, "Environment? ")
Terminalwire.Server.Context.puts(ctx, "→ #{name}")
0
end
Summary
Functions
The program name + args the client launched with.
End the session with an exit status (defaults to 0).
Read keystrokes for the duration of fun: the client puts its terminal in
mode ("raw" or "cbreak") and streams keypresses, restoring it when the
block exits. fun receives a 0-arity reader returning the next chunk (nil at
close).
Drain the client's stdin to EOF (for piped input).
Pull up to n bytes from the client's stdin. Returns {data, eof}.
Read a single keypress (cbreak: echo + signal keys on). Returns the chunk.
Lower-level: returns {:ok, value} | {:error, code, message}.
The client's terminal as a Terminalwire.Server.Terminal struct
(cols, rows, tty?, …), so server code can do Context.terminal(ctx).cols
instead of digging through the raw handshake map.
Types
Functions
The program name + args the client launched with.
End the session with an exit status (defaults to 0).
Read keystrokes for the duration of fun: the client puts its terminal in
mode ("raw" or "cbreak") and streams keypresses, restoring it when the
block exits. fun receives a 0-arity reader returning the next chunk (nil at
close).
Drain the client's stdin to EOF (for piped input).
Pull up to n bytes from the client's stdin. Returns {data, eof}.
Read a single keypress (cbreak: echo + signal keys on). Returns the chunk.
Lower-level: returns {:ok, value} | {:error, code, message}.
The client's terminal as a Terminalwire.Server.Terminal struct
(cols, rows, tty?, …), so server code can do Context.terminal(ctx).cols
instead of digging through the raw handshake map.