package b0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=e9aa779e66c08fc763019f16d4706f465d16c05d6400b58fbd0313317ef33ddea51952e2b058db28e65f7ddb7012f328c8bf02d8f1da17bb543348541a2587f0
doc/b0.std/B0_std_cli/index.html
Module B0_std_cli
Source
Cmdliner support for more
programs.
The cookbook blueprints has some examples.
Miscellaneous argument converters
path
is a converter for file system paths. No existence checks are performed on the path. Completes files and directories.
filepath
is a converter for file paths. No existence checks are performed on the path. Completes files.
dirpath
is a converter for directory paths. No existence checks are performed on the path. Completes directories.
cmd
is a converter for commands which are parsed using B0_std.Cmd.of_string
. Completes files.
ANSI text styling
val no_color :
?docs:string ->
?env:Cmdliner.Cmd.Env.info option ->
unit ->
bool Cmdliner.Term.t
no_color ~docs ~env ()
is a --no-color
command line flag.
docs
is the manual section in which the option is documented (defaults toCmdliner.Manpage.s_common_options
)env
is an environment variable to define the default value. It defaults tono_color_var
which isNO_COLOR
. The environment variable lookup performed by cmdliner for flags is tweaked to match what is requested by https://no-color.org.
val set_no_color :
?docs:Cmdliner.Manpage.section_name ->
?env:Cmdliner.Cmd.Env.info option ->
unit ->
unit Cmdliner.Term.t
set_no_color ()
behaves like no_color
and sets B0_std.Fmt.styler
to Plain
when it's true
. See an example.
no_color_var
describes the default environment variable NO_COLOR
of no_color
and set_no_color
.
Log level
val log_level :
?docs:Cmdliner.Manpage.section_name ->
?absent:B0_std.Log.level ->
?env:Cmdliner.Cmd.Env.info option ->
unit ->
B0_std.Log.level Cmdliner.Term.t
log_level ~docs ~abset ~env ()
is a command line interface for specifying a log level with these options:
- The
--log-level=LEVEL
option to specify the level directly. - The repeatable
-v
and--verbose
flags specify the level asInfo
(one occurence) orDebug
(two occurences). - The
-q
and--quiet
flags take over all options and specify the level asQuiet
.
The other arguments are:
docs
is the manual section in which the options are documented (defaults toCmdliner.Manpage.s_common_options
)absent
is the level when none is specified it defaults toB0_std.Log.level.Warning
env
is an environment variable to define the default level value. It defaults tolog_level_var
which isLOG_LEVEL
.
val set_log_level :
?docs:Cmdliner.Manpage.section_name ->
?absent:B0_std.Log.level ->
?env:Cmdliner.Cmd.Env.info option ->
unit ->
unit Cmdliner.Term.t
set_log_level
behaves like log_level
and sets the log level. See an example.
log_level_var
describes the default environment variable LOG_LEVEL
of log_level
and set_log_level
.
log_level_conv
is a converter for log level.
Specifying output level of details
s_output_format_options
is a manual section called "OUTPUT DETAILS OPTIONS"
type output_details = [
| `Short
(*Short lined-based output with essential details.
*)| `Normal
(*Normal output.
*)| `Long
(*Long output with as much details as possible.
*)
]
The type for specifying output level of details.
output_details ()
are mutually exclusive options to specify an output level of detail as `Short
, `Normal
or `Long
.
- Without options this is
`Normal
. - Options
-s
or--short
specify`Short
. - Options
-l
or--long
specify`Long
.
docs
is the manual section in which options are documented, defaults to s_output_details_options
.