mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-07 03:35:30 -05:00
add CCFormat.{h,v,hov,hv}box printer combinators
This commit is contained in:
parent
cb9dc59567
commit
33b61e8bab
2 changed files with 40 additions and 1 deletions
|
|
@ -89,6 +89,26 @@ let map f pp fmt x =
|
||||||
pp fmt (f x);
|
pp fmt (f x);
|
||||||
()
|
()
|
||||||
|
|
||||||
|
let vbox ?(i=0) pp out x =
|
||||||
|
Format.pp_open_vbox out i;
|
||||||
|
pp out x;
|
||||||
|
Format.pp_close_box out ()
|
||||||
|
|
||||||
|
let hovbox ?(i=0) pp out x =
|
||||||
|
Format.pp_open_hovbox out i;
|
||||||
|
pp out x;
|
||||||
|
Format.pp_close_box out ()
|
||||||
|
|
||||||
|
let hvbox ?(i=0) pp out x =
|
||||||
|
Format.pp_open_hvbox out i;
|
||||||
|
pp out x;
|
||||||
|
Format.pp_close_box out ()
|
||||||
|
|
||||||
|
let hbox pp out x =
|
||||||
|
Format.pp_open_hbox out ();
|
||||||
|
pp out x;
|
||||||
|
Format.pp_close_box out ()
|
||||||
|
|
||||||
(** {2 IO} *)
|
(** {2 IO} *)
|
||||||
|
|
||||||
let output fmt pp x = pp fmt x
|
let output fmt pp x = pp fmt x
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,26 @@ val quad : 'a printer -> 'b printer -> 'c printer -> 'd printer -> ('a * 'b * 'c
|
||||||
|
|
||||||
val map : ('a -> 'b) -> 'b printer -> 'a printer
|
val map : ('a -> 'b) -> 'b printer -> 'a printer
|
||||||
|
|
||||||
(** {2 ASCII codes}
|
val vbox : ?i:int -> 'a printer -> 'a printer
|
||||||
|
(** Wrap the printer in a vertical box
|
||||||
|
@param i level of indentation within the box (default 0)
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
|
val hvbox : ?i:int -> 'a printer -> 'a printer
|
||||||
|
(** Wrap the printer in a horizontal/vertical box
|
||||||
|
@param i level of indentation within the box (default 0)
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
|
val hovbox : ?i:int -> 'a printer -> 'a printer
|
||||||
|
(** Wrap the printer in a horizontal or vertical box
|
||||||
|
@param i level of indentation within the box (default 0)
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
|
val hbox : 'a printer -> 'a printer
|
||||||
|
(** Wrap the printer in an horizontal box
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
|
(** {2 ANSI codes}
|
||||||
|
|
||||||
Use ANSI escape codes https://en.wikipedia.org/wiki/ANSI_escape_code
|
Use ANSI escape codes https://en.wikipedia.org/wiki/ANSI_escape_code
|
||||||
to put some colors on the terminal.
|
to put some colors on the terminal.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue