From 16281b0e8deb6b3bf86ac0b9381f3fdf89b22b58 Mon Sep 17 00:00:00 2001 From: Simponic Date: Mon, 2 Jan 2023 19:10:23 -0700 Subject: Now a simple logo draws in the center of the terminal, terminal size is limited, and resizing support --- lib/chessh/schema/key.ex | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'lib/chessh/schema') diff --git a/lib/chessh/schema/key.ex b/lib/chessh/schema/key.ex index adf018d..df790e2 100644 --- a/lib/chessh/schema/key.ex +++ b/lib/chessh/schema/key.ex @@ -20,14 +20,6 @@ defmodule Chessh.Key do |> validate_format(:key, ~r/^(?!ssh-dss).+/, message: "DSA keys are not supported") end - defp update_encode_key(attrs, field) do - if Map.has_key?(attrs, field) do - Map.update!(attrs, field, &encode_key/1) - else - attrs - end - end - def encode_key(key) do if is_tuple(key) do case key do @@ -39,8 +31,15 @@ defmodule Chessh.Key do else key end - # Remove comment at end of key |> String.replace(~r/ [^ ]+\@[^ ]+$/, "") |> String.trim() end + + defp update_encode_key(attrs, field) do + if Map.has_key?(attrs, field) do + Map.update!(attrs, field, &encode_key/1) + else + attrs + end + end end -- cgit v1.3