diff --git a/src/core/CCFormat.ml b/src/core/CCFormat.ml index cd12650e..8fd37a8e 100644 --- a/src/core/CCFormat.ml +++ b/src/core/CCFormat.ml @@ -89,6 +89,26 @@ let map f pp fmt 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} *) let output fmt pp x = pp fmt x diff --git a/src/core/CCFormat.mli b/src/core/CCFormat.mli index 3bf7f622..8a328f77 100644 --- a/src/core/CCFormat.mli +++ b/src/core/CCFormat.mli @@ -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 -(** {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 to put some colors on the terminal.