package b0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=00a6868b4dfa34565d0141b335622a81a0e8d5b9e3c6dfad025dabfa3df2db2a1302b492953bbbce30c3a4406c324fcec25250a00b38f6d18a69e15605e3b07e
doc/b0_b00_kit/B00_cli/B0_std/index.html
Module B00_cli.B0_std
Fragments for setting up B0_std.
Setup
Configure colored output and log verbosity and the B0_std.Os.Cmd.spawn_tracer.
val get_tty_cap : B0_std.Tty.cap option option -> B0_std.Tty.capget_tty_cap cap determines cap with B0_std.Tty.cap and B0_std.Tty.of_fd on Unix.stdout if cap is None or Some None.
val get_log_level : B0_std.Log.level option -> B0_std.Log.levelget_log_level level determines level with B0_std.Log.Warning if level is None.
val setup :
B0_std.Tty.cap ->
B0_std.Log.level ->
log_spawns:B0_std.Log.level ->
unitsetup tty_cap log_level ~log_spawns sets:
B0_std.Fmt.set_tty_styling_capwithtty_cap.B0_std.Log.set_levelwithlog_level.B0_std.Os.Cmd.set_spawn_tracerwithB0_std.Log.spawn_tracerlog_spawnsifflevel >= 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 arguments
val tty_cap_of_string : string -> (B0_std.Tty.cap option, string) Stdlib.resulttty_cap_of_string v parses:
"","auto"intoNone"always"intoSome `Ansi"never"intoSome `None
val tty_cap :
?docs:string ->
?env:Cmdliner.Cmd.Env.info ->
unit ->
B0_std.Tty.cap option option Cmdliner.Term.ttty_cap ~docs ~env () is a cli interface for specifiying a TTY capability with a --color option. docs is where the options are documented (defaults to Cmdliner.Manpage.s_common_options). 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:B0_std.Log.level ->
?docs:string ->
?env:Cmdliner.Cmd.Env.info ->
unit ->
B0_std.Log.level option Cmdliner.Term.tlog_level ~none ~docs ~env () is a cli interface for specifiying a logging level with various options. docs is where the options are documented (defaults to Cmdliner.Manpage.s_common_options). 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.