package b0
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=dba2fc571f39f3b8e87ee55c77bdec7ec6a5ddc7d99b8b20aeda848af546be04
md5=51ee1d66acc4d7f87bdceac1341b7711
doc/b00_kit/B00_std_ui/index.html
Module B00_std_ui
B00_std
setup and cli fragments.
Setup
Configure colored output and log verbosity and the B00_std.Os.Cmd.spawn_tracer
.
val get_tty_cap : B00_std.Tty.cap option option -> B00_std.Tty.cap
get_tty_cap cap
determines cap
with Tty.cap
and Tty.of_fd
on Unix.stdout
if cap
is None
or Some None
.
val get_log_level : B00_std.Log.level option -> B00_std.Log.level
get_log_level level
determines level
with Log.Warning
if level
is None
.
val setup :
B00_std.Tty.cap ->
B00_std.Log.level ->
log_spawns:B00_std.Log.level ->
unit
setup tty_cap log_level ~log_spawns
sets:
B00_std.Fmt.set_tty_styling_cap
withtty_cap
.B00_std.Log.set_level
withlog_level
.B00_std.Os.Cmd.set_spawn_tracer
withB00_std.Log.spawn_tracer
log_spawns
ifflevel >= log_spawn
.
Warning. If level < log_spawn
but Log.level
is increased after this call, the spawns won't be traced (most cli programs do not change after the initial setup). Do your own setup if that is a problem for you.
Cli argument converters
val fpath : B00_std.Fpath.t Cmdliner.Arg.conv
fpath
is a converter for file paths. No existence checks are performed on the path.
val cmd : B00_std.Cmd.t Cmdliner.Arg.conv
cmd
is a converter for commands.
Cli arguments
val tty_cap_of_string :
string ->
(B00_std.Tty.cap option, string) Stdlib.result
tty_cap_of_string v
parses:
""
,"auto"
intoNone
"always"
intoSome `Ansi
"never"
intoSome `None
val tty_cap :
?docs:string ->
?env:Cmdliner.Arg.env ->
unit ->
B00_std.Tty.cap option option Cmdliner.Term.t
tty_cap ~docs ~env ()
is a cli interface for specifiying a TTY capability with a --color
option. docs
is where the options are documented. env
, if provided, is an environment variable to set the value (use something like "MYPROGRAM_COLOR"
). None
is returned if the value is not set on the cli or via the env var.
val log_level :
?none:B00_std.Log.level ->
?docs:string ->
?env:Cmdliner.Arg.env ->
unit ->
B00_std.Log.level option Cmdliner.Term.t
log_level ~none ~docs ~env ()
is a cli interface for specifiying a logging level with various options. docs
is where the options are documented. env
, if provided, is an environment variable to set the value (use something like "MYPROGRAM_VERBOSITY"
). none
is used to document the level when the log level is unspecified (defaults to Log.Warning
). None
is returned if the value is not set on the cli or via the env var.