diff options
author | Simponic <loganhunt@simponic.xyz> | 2022-12-31 16:32:56 -0700 |
---|---|---|
committer | Simponic <loganhunt@simponic.xyz> | 2022-12-31 16:33:12 -0700 |
commit | 52a3ed7c5700fa398efb8a4aff9d586a850e3d58 (patch) | |
tree | 0ac4b127c99d399265159182edf4dc63bd9ba675 /lib/chessh/ssh/client.ex | |
parent | 58d0b1a89c461467c9ea6229f9a6b3d5ed573da5 (diff) | |
download | chessh-52a3ed7c5700fa398efb8a4aff9d586a850e3d58.tar.gz chessh-52a3ed7c5700fa398efb8a4aff9d586a850e3d58.zip |
Better logging, close previous sessions once session threshold has been reached
Diffstat (limited to 'lib/chessh/ssh/client.ex')
-rw-r--r-- | lib/chessh/ssh/client.ex | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/chessh/ssh/client.ex b/lib/chessh/ssh/client.ex index 35893f1..eba188f 100644 --- a/lib/chessh/ssh/client.ex +++ b/lib/chessh/ssh/client.ex @@ -1,16 +1,27 @@ defmodule Chessh.SSH.Client do - alias Chessh.SSH.Client + alias IO.ANSI require Logger use GenServer - # TODO: tui_state_stack is like [:menu, :player_settings, :change_password] or [:menu, {:game, game_id}, {:game_chat, game_id}] + @default_message [ + ANSI.clear(), + ANSI.reset(), + ANSI.home(), + ["Hello, world"] + ] - defstruct [:tui_pid, :width, :height, :player_id, :tui_state_stack] + defmodule State do + defstruct tui_pid: nil, + width: nil, + height: nil, + player_session: nil, + state_statck: [] + end @impl true - def init([tui_pid, width, height] = args) do - Logger.debug("#{inspect(args)}") - {:ok, %Client{tui_pid: tui_pid, width: width, height: height}} + def init([%State{tui_pid: tui_pid} = state]) do + send(tui_pid, {:send_data, @default_message}) + {:ok, state} end end |