B0_cmdletSourceCmdlets.
Cmdlets are used to define custom software life-cycle procedures. Examples range from invoking linters on your sources to perform post build checks or actions.
See the cmdlet manual for a short introduction.
Cmdlets run in the same environment in which b0 is invoked (XXX lift that restriction ?).
The type for cmdlets.
The type for cmdlet implementations. A function that given an execution context and command line arguments for the cmdlet should eventually specify a way to exit.
v n ~doc ~meta cmd is a cmdlet named n implemented by cmd with doc string doc and metadata meta.
exit_of_result v exits with B00_cli.Exit.ok if v is Ok () and logs the Error and exits with B00_cli.Exit.some_error if v is Error _.
exit_of_result' v exits with e if v is Ok e and logs the Error and exits with B00_cli.Exit.some_error if v is Error _.
in_scope_dir env p is Fpath.(Env.root_dir env // p)).
in_scope_dir env p is Fpath.(Env.root_dir env // p)).
in_scope_dir env p is Fpath.(Env.scratch_dir env // p)).
val exec_file :
?env:B0_std.Os.Env.assignments ->
?cwd:B0_std.Fpath.t ->
B0_std.Fpath.t ->
cmdexec_file exe e args executes the file exe with arguments cmd. The scope directory is used as the default cwd and to resolve relative exe paths.
val exec_tool :
?env:B0_std.Os.Env.assignments ->
?cwd:B0_std.Fpath.t ->
B0_std.Cmd.tool ->
cmdexec_tool tool e args executes the tool exe with arguments cmd The scope directory is used as the default cwd. exe is looked up using B0_std.Os.Cmd.get_tool, if that fails the error is logged and we exit we and exits with B00_cli.Exit.some_error.
Use B00_cli and B0_cli to parse cmdlet arguments and B00_cli.Exit for exit codes. Given a suitable Cmdliner term this function can be used to implement the cmdlet's command.
val eval :
?man_xrefs:Cmdliner.Manpage.xref list ->
?man:Cmdliner.Manpage.block list ->
?envs:Cmdliner.Cmd.Env.info list ->
?exits:Cmdliner.Cmd.Exit.info list ->
?sdocs:string ->
?docs:string ->
?doc:string ->
?version:string ->
Env.t ->
B0_std.Cmd.t ->
B0_std.Os.Exit.t Cmdliner.Term.t ->
B0_std.Os.Exit.teval e cmd t defines a cmdlet command by evaluating the cmdliner term t with arguments cmd. The menagerie of optional parameters define a Cmdliner.Term.info value for the term, see the docs there. By default doc is derived from the cmdlet's doc string and exits is B00_cli.Exit.infos.
include B0_def.S with type t := tdefine ~doc ~meta n defines name n in the current scope with documentation string doc (defaults to "undocumented")e and metadata meta (defaults to B0_meta.empty). Defining a duplicate value in a scope raises Duplicate.
def_kind is the kind of defined value.
def v is the definition of value v.
has_meta k u is B0_meta.mem k (B0_unit.meta u).
find_meta k u is B0_meta.find k (B0_unit.meta u).
get_meta m k u is Ok v if find_meta k u is Some v and a final user friendly error message if None.
get n looks up the value named n and errors the B0 file if there no such n.
get_or_suggest n is the value named n or a (possibly empty) list of suggested values whose name could match n.
get_or_hint n is the value named n or an error message that indicates that n could not be found with suggested names.
get_list_or_hint ns are the value named ns or an error that indicates the names that could not be found with suggested names. If empty_means_all is true (defaults to false) an empty ns returns list () sorted by name.
pp_name_str v pretty prints value names.
pp_name v formats v's name.
pp_doc formats v's doc string.
pp_synopsis formats v's name and its doc string.
pp formats v 's name, its doc string and its metadata dictionary.