B0_cmdletCmdlets.
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 ?).
module Env : sig ... endCmdlet execution environments.
type cmd = Env.t -> B00_std.Cmd.t -> B00_std.Os.Exit.tThe type for cmdlet implementations. A function that given an execution context and command line arguments for the cmdlet should eventually exit in some way.
v n ~doc ~meta cmd is a cmdlet named n implemented by cmd with doc string doc and metadata meta.
val exit_of_result : ('a, string) result -> B00_std.Os.Exit.texit_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 _.
val in_scope_dir : Env.t -> B00_std.Fpath.t -> B00_std.Fpath.tin_scope_dir env p is Fpath.(Env.root_dir env // p)).
val in_root_dir : Env.t -> B00_std.Fpath.t -> B00_std.Fpath.tin_scope_dir env p is Fpath.(Env.root_dir env // p)).
val in_scratch_dir : Env.t -> B00_std.Fpath.t -> B00_std.Fpath.tin_scope_dir env p is Fpath.(Env.scratch_dir env // p)).
val exec : ?env:B00_std.Os.Env.assignments -> ?cwd:B00_std.Fpath.t -> B00_std.Fpath.t -> cmdexec exe env cmd executes the file exe with arguments cmd. The scope directory is used as the default cwd and to resolve relative exe paths.
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.Term.env_info list -> ?exits:Cmdliner.Term.exit_info list ->
?sdocs:string -> ?docs:string -> ?doc:string -> ?version:string -> Env.t -> B00_std.Cmd.t -> B00_std.Os.Exit.t Cmdliner.Term.t -> B00_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 := tval define : ?doc:string -> ?meta:B0_meta.t -> string -> B0_def.defdefine ~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.
val def : t -> B0_def.defdef v is the definition of value v.
val name : t -> stringname v is v's name.
val basename : t -> stringbasename v is v's name without the scope.
val doc : t -> stringdoc v is v's documentation string.
val has_meta : 'a B0_meta.key -> t -> boolhas_meta k u is B0_meta.mem k (B0_unit.meta u).
val find_meta : 'a B0_meta.key -> t -> 'a optionfind_meta k u is B0_meta.find k (B0_unit.meta u).
val get_meta : 'a B0_meta.key -> t -> ('a, string) resultget_meta m k u is Ok v if find_meta k u is Some v and a final user friendly error message if None.
val add : t -> unitadd v adds the value v to the list of defined values.
val list : unit -> t listlist () is the list of units.
val find : string -> t optionfind n is the value named n (if any).
val get : string -> tget 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.
val pp_name_str : string B00_std.Fmt.tpp_name_str v pretty prints value names.
val pp_name : t B00_std.Fmt.tpp_name v formats v's name.
val pp_doc : t B00_std.Fmt.tpp_doc formats v's doc string.
val pp_synopsis : t B00_std.Fmt.tpp_synopsis formats v's name and its doc string.
val pp : t B00_std.Fmt.tpp formats v 's name, its doc string and its metadata dictionary.