Module OpamConsole
Console output, ANSI color, logging and user querying
val debug : unit -> boolval verbose : unit -> boolval color : unit -> boolval utf8 : unit -> boolval utf8_extended : unit -> boolval disp_status_line : unit -> bool
type text_style=[|`black|`blue|`bold|`crossed|`cyan|`green|`magenta|`red|`underline|`white|`yellow]Settable attributes for ANSI terminal output. Nesting is generally not handled.
val colorise : text_style -> string -> stringHelper coloring functions. Returns the string unchanged if color is disabled
val colorise' : text_style list -> string -> stringval acolor : text_style -> unit -> string -> stringval acolor_w : int -> text_style -> Stdlib.out_channel -> string -> unit
module Symbols : sig ... endval utf8_symbol : OpamCompat.Uchar.t -> ?alternates:OpamCompat.Uchar.t list -> string -> string
val timer : unit -> unit -> floatTimers, only active when debug is on. Returns the time between the application to each argument, in seconds
val log : string -> ?level:int -> ('a, Stdlib.out_channel, unit) Stdlib.format -> 'alog section ~level fmt args. Used for debug messages, default level is 1
val slog : ('a -> string) -> Stdlib.out_channel -> 'a -> unitHelper to pass stringifiers to log (use
log "%a" (slog to_string) xrather thanlog "%s" (to_string x)to avoid costly unneeded stringifications
val error : ('a, unit, string, unit) Stdlib.format4 -> 'aval warning : ('a, unit, string, unit) Stdlib.format4 -> 'aval note : ('a, unit, string, unit) Stdlib.format4 -> 'aval errmsg : ('a, unit, string, unit) Stdlib.format4 -> 'aMessage without prefix, reformat or newline, to stderr (useful to continue error messages without repeating "
ERROR")
val error_and_exit : OpamStd.Sys.exit_reason -> ('a, unit, string, 'b) Stdlib.format4 -> 'aval msg : ('a, unit, string, unit) Stdlib.format4 -> 'aval formatted_msg : ?indent:int -> ('a, unit, string, unit) Stdlib.format4 -> 'aval header_msg : ('a, unit, string, unit) Stdlib.format4 -> 'aval header_error : ('a, unit, string, ('b, unit, string, unit) Stdlib.format4 -> 'b) Stdlib.format4 -> 'aval carriage_delete : unit -> unitErase the current line on stdout (doesn't flush stdout)
val status_line : ('a, unit, string, unit) Stdlib.format4 -> 'aDisplay a dynamic status line to stdout, that will be erased on next call. The message should not be wider than screen nor contain newlines. Use
clear_statuswhen the status line should be erased.
val clear_status : unit -> unitErase the status line and restore the cursor to the start of the line
val confirm : ?default:bool -> ('a, unit, string, bool) Stdlib.format4 -> 'aAsk the user to press Y/y/N/n to continue (returns a boolean). Defaults to true (yes) if unspecified
val read : ('a, unit, string, string option) Stdlib.format4 -> 'aRead some input from the user (returns a string option)
val print_table : ?cut:[ `Wrap of string | `Truncate | `None ] -> Stdlib.out_channel -> sep:string -> string list list -> unitPrints a table; generally called on tables passed through
align_table. The defaultcutis to wrap on stdout, stderr, keep as-is otherwise.`Wrap sepprependssepon wrapped lines