Kitty Graphics Protocol in OCaml
terminal
graphics
ocaml
1(*---------------------------------------------------------------------------
2 Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3 SPDX-License-Identifier: ISC
4 ---------------------------------------------------------------------------*)
5
6(** Kitty Graphics Protocol Response
7
8 Parse and interpret terminal responses to graphics commands. *)
9
10type t
11(** A parsed terminal response. *)
12
13val parse : string -> t option
14(** Parse a response from terminal output. *)
15
16val is_ok : t -> bool
17(** Check if the response indicates success. *)
18
19val message : t -> string
20(** Get the response message. *)
21
22val error_code : t -> string option
23(** Extract the error code if this is an error response. *)
24
25val image_id : t -> int option
26(** Get the image ID from the response. *)
27
28val image_number : t -> int option
29(** Get the image number from the response. *)
30
31val placement_id : t -> int option
32(** Get the placement ID from the response. *)