summaryrefslogtreecommitdiff
path: root/lib/chessh/schema
diff options
context:
space:
mode:
authorSimponic <loganhunt@simponic.xyz>2023-01-02 19:10:23 -0700
committerSimponic <loganhunt@simponic.xyz>2023-01-02 19:10:23 -0700
commit16281b0e8deb6b3bf86ac0b9381f3fdf89b22b58 (patch)
tree80295ecaaad54c82ea1541d0932f8e8043f88515 /lib/chessh/schema
parent2bf058d5db79cc75f87d9accfeb9773d5bf29686 (diff)
downloadchessh-16281b0e8deb6b3bf86ac0b9381f3fdf89b22b58.tar.gz
chessh-16281b0e8deb6b3bf86ac0b9381f3fdf89b22b58.zip
Now a simple logo draws in the center of the terminal, terminal size is limited, and resizing support
Diffstat (limited to 'lib/chessh/schema')
-rw-r--r--lib/chessh/schema/key.ex17
1 files changed, 8 insertions, 9 deletions
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