From 1c47a847506c7a8bafba21014529233bd6545fdd Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Tue, 18 Nov 2025 18:39:20 +0100 Subject: [PATCH] Extract `mpv/key` to `input` To separate the concern from `mpv` --- src/{mpv/internal/key.gleam => input/internal.gleam} | 0 src/{mpv => input}/key.gleam | 6 +++--- src/mpv/control.gleam | 2 +- src/mpv/mpv.gleam | 2 +- test/{mpv/key_test.gleam => input/input_test.gleam} | 2 +- test/mpv/control_test.gleam | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) rename src/{mpv/internal/key.gleam => input/internal.gleam} (100%) rename src/{mpv => input}/key.gleam (83%) rename test/{mpv/key_test.gleam => input/input_test.gleam} (93%) diff --git a/src/mpv/internal/key.gleam b/src/input/internal.gleam similarity index 100% rename from src/mpv/internal/key.gleam rename to src/input/internal.gleam diff --git a/src/mpv/key.gleam b/src/input/key.gleam similarity index 83% rename from src/mpv/key.gleam rename to src/input/key.gleam index 9ef4a1b..12fd6cb 100644 --- a/src/mpv/key.gleam +++ b/src/input/key.gleam @@ -1,7 +1,7 @@ import gleam/erlang/atom import gleam/list -import mpv/internal/key as internal_key +import input/internal as internal_input pub type Key { Char(String) @@ -40,11 +40,11 @@ pub fn from_list(l: List(String)) -> Key { pub fn start_raw_shell() { let no_shell = atom.create("noshell") let raw = atom.create("raw") - internal_key.shell_start_interactive(#(no_shell, raw)) + internal_input.shell_start_interactive(#(no_shell, raw)) } pub fn read_input_until_key(l: List(String)) -> Key { - let l = internal_key.read_input() |> list.wrap |> list.append(l, _) + let l = internal_input.read_input() |> list.wrap |> list.append(l, _) case from_list(l) { Continue -> read_input_until_key(l) diff --git a/src/mpv/control.gleam b/src/mpv/control.gleam index ad5b38d..7f63d9d 100644 --- a/src/mpv/control.gleam +++ b/src/mpv/control.gleam @@ -2,8 +2,8 @@ import gleam/json import gleam/result import gleam/string +import input/key.{type Key, Char} import mpv/internal/control as internal_control -import mpv/key.{type Key, Char} import tcp/reason.{type Reason} import tcp/tcp.{type Socket} diff --git a/src/mpv/mpv.gleam b/src/mpv/mpv.gleam index e433703..ab8d2b1 100644 --- a/src/mpv/mpv.gleam +++ b/src/mpv/mpv.gleam @@ -4,8 +4,8 @@ import gleam/otp/actor import gleam/result import gleam/string +import input/key import mpv/control.{type Control} -import mpv/key import tcp/reason import tcp/tcp.{type Socket} diff --git a/test/mpv/key_test.gleam b/test/input/input_test.gleam similarity index 93% rename from test/mpv/key_test.gleam rename to test/input/input_test.gleam index c291d88..3777af5 100644 --- a/test/mpv/key_test.gleam +++ b/test/input/input_test.gleam @@ -1,7 +1,7 @@ import gleam/list import gleeunit -import mpv/key.{type Key, Char, csi, esc} +import input/key.{type Key, Char, csi, esc} pub fn main() -> Nil { gleeunit.main() diff --git a/test/mpv/control_test.gleam b/test/mpv/control_test.gleam index 66cb559..8521f88 100644 --- a/test/mpv/control_test.gleam +++ b/test/mpv/control_test.gleam @@ -1,9 +1,9 @@ import gleam/list import gleeunit +import input/key.{type Key, Char} import mpv/control.{type Control} import mpv/internal/control as control_internal -import mpv/key.{type Key, Char} pub fn main() -> Nil { gleeunit.main()