14 lines
436 B
OCaml
14 lines
436 B
OCaml
open Processing
|
|
|
|
let read_all colours order =
|
|
In_channel.set_binary_mode stdin true;
|
|
let open Types in
|
|
let t = Emitter.create and culr = Culriser.create order [] colours in
|
|
Emitter.serialise t (Ansi [ Fg (Culriser.next culr) ]);
|
|
Angstrom_unix.parse_many ~buf_size:4096 Parse.culr_parse
|
|
(fun c -> c |> ansi_filter |> Culriser.serialise_with_colour culr t)
|
|
stdin
|
|
|> function
|
|
| _, Ok _ -> Emitter.flush t
|
|
| _ -> ()
|