From ffa3d553f693494c218a0244c946ba83dfbf7cd1 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Sun, 1 Oct 2023 20:41:48 -0600 Subject: init --- lib/ssh/screen.ex | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 lib/ssh/screen.ex (limited to 'lib/ssh/screen.ex') diff --git a/lib/ssh/screen.ex b/lib/ssh/screen.ex new file mode 100644 index 0000000..8f0c7bd --- /dev/null +++ b/lib/ssh/screen.ex @@ -0,0 +1,18 @@ +defmodule TrongleSSH.SSH.Screen do + @callback render(width :: integer(), height :: integer(), state :: any()) :: any() + @callback input(width :: integer(), height :: integer(), action :: any(), state :: any()) :: + any() + + defmacro __using__(_) do + quote do + @behaviour TrongleSSH.SSH.Screen + use GenServer + + def handle_info({:render, width, height}, state), + do: {:noreply, render(width, height, state)} + + def handle_info({:input, width, height, action}, state), + do: {:noreply, input(width, height, action, state)} + end + end +end -- cgit v1.3