Compare commits

4 Commits

Author SHA1 Message Date
Alexander Heldt
d1053f687b Add ability to listen (tap) the input
By doing something like
```
fn input_output_loop(input_output: Subject(List(String))) -> Nil {
  let output = process.receive_forever(input_output)

  echo output

  input_output_loop(input_output)
}
```
2025-11-19 17:45:03 +01:00
Alexander Heldt
53f877f03d Add ability to ??? 2025-11-19 17:45:03 +01:00
Alexander Heldt
efc0604c1d Correct io_get_chars comment/documentation 2025-11-18 18:42:11 +01:00
Alexander Heldt
a048e084e7 Add ability to create character sequences as Input 2025-11-18 18:42:09 +01:00

View File

@@ -102,7 +102,7 @@ fn handle_message(
/// This is useful to ultimately create a `Control` without the user having to
/// input all of the character(s) needed.
fn read_input(
subject: Subject(Control),
agent: Subject(Control),
inject_input: Subject(Key),
tap_input: Subject(List(String)),
) -> Nil {
@@ -111,10 +111,13 @@ fn read_input(
Ok(_) | Error(_) -> []
}
let _ =
case
key.read_input_until_key(buffer, tap_input)
|> control.from_key
|> result.map(process.send(subject, _))
read_input(subject, inject_input, tap_input)
{
Error(_) -> Nil
Ok(control) -> process.send(agent, control)
}
read_input(agent, inject_input, tap_input)
}