aboutsummaryrefslogtreecommitdiff
path: root/lib/ssh/screen.ex
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-10-01 20:41:48 -0600
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-10-01 20:41:48 -0600
commitffa3d553f693494c218a0244c946ba83dfbf7cd1 (patch)
tree092a824dad118c37960ab67da98cdbc445a35d2b /lib/ssh/screen.ex
downloadtronglessh-ffa3d553f693494c218a0244c946ba83dfbf7cd1.tar.gz
tronglessh-ffa3d553f693494c218a0244c946ba83dfbf7cd1.zip
Diffstat (limited to 'lib/ssh/screen.ex')
-rw-r--r--lib/ssh/screen.ex18
1 files changed, 18 insertions, 0 deletions
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