Kitty Graphics Protocol in OCaml
terminal graphics ocaml
at main 1.1 kB view raw
1(*--------------------------------------------------------------------------- 2 Copyright (c) 2025 Anil Madhavapeddy. All rights reserved. 3 SPDX-License-Identifier: ISC 4 ---------------------------------------------------------------------------*) 5 6(* Cmdliner Support for Kitty Graphics Protocol *) 7 8open Cmdliner 9 10let graphics_docs = "GRAPHICS OPTIONS" 11 12let graphics_term = 13 let doc = "Force graphics output enabled, ignoring terminal detection." in 14 let enable = Arg.info [ "g"; "graphics" ] ~doc ~docs:graphics_docs in 15 let doc = "Disable graphics output, use text placeholders instead." in 16 let disable = Arg.info [ "no-graphics" ] ~doc ~docs:graphics_docs in 17 let doc = "Force tmux passthrough mode for graphics." in 18 let tmux = Arg.info [ "tmux" ] ~doc ~docs:graphics_docs in 19 let choose enable disable tmux : Kgp.Terminal.graphics_mode = 20 if enable then `Enabled 21 else if disable then `Disabled 22 else if tmux then `Tmux 23 else `Auto 24 in 25 Term.( 26 const choose 27 $ Arg.(value & flag enable) 28 $ Arg.(value & flag disable) 29 $ Arg.(value & flag tmux))