Extract mpv/key to input

To separate the concern from `mpv`
This commit is contained in:
Alexander Heldt
2025-11-18 18:39:20 +01:00
parent 417b5a2559
commit 1c47a84750
6 changed files with 7 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
import gleam/erlang/atom import gleam/erlang/atom
import gleam/list import gleam/list
import mpv/internal/key as internal_key import input/internal as internal_input
pub type Key { pub type Key {
Char(String) Char(String)
@@ -40,11 +40,11 @@ pub fn from_list(l: List(String)) -> Key {
pub fn start_raw_shell() { pub fn start_raw_shell() {
let no_shell = atom.create("noshell") let no_shell = atom.create("noshell")
let raw = atom.create("raw") 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 { 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) { case from_list(l) {
Continue -> read_input_until_key(l) Continue -> read_input_until_key(l)

View File

@@ -2,8 +2,8 @@ import gleam/json
import gleam/result import gleam/result
import gleam/string import gleam/string
import input/key.{type Key, Char}
import mpv/internal/control as internal_control import mpv/internal/control as internal_control
import mpv/key.{type Key, Char}
import tcp/reason.{type Reason} import tcp/reason.{type Reason}
import tcp/tcp.{type Socket} import tcp/tcp.{type Socket}

View File

@@ -4,8 +4,8 @@ import gleam/otp/actor
import gleam/result import gleam/result
import gleam/string import gleam/string
import input/key
import mpv/control.{type Control} import mpv/control.{type Control}
import mpv/key
import tcp/reason import tcp/reason
import tcp/tcp.{type Socket} import tcp/tcp.{type Socket}

View File

@@ -1,7 +1,7 @@
import gleam/list import gleam/list
import gleeunit import gleeunit
import mpv/key.{type Key, Char, csi, esc} import input/key.{type Key, Char, csi, esc}
pub fn main() -> Nil { pub fn main() -> Nil {
gleeunit.main() gleeunit.main()

View File

@@ -1,9 +1,9 @@
import gleam/list import gleam/list
import gleeunit import gleeunit
import input/key.{type Key, Char}
import mpv/control.{type Control} import mpv/control.{type Control}
import mpv/internal/control as control_internal import mpv/internal/control as control_internal
import mpv/key.{type Key, Char}
pub fn main() -> Nil { pub fn main() -> Nil {
gleeunit.main() gleeunit.main()