package b0

  1. Overview
  2. Docs
Software construction and deployment kit

Install

Dune Dependency

Authors

Maintainers

Sources

b0-0.0.4.tbz
sha512=665735c8b7a8674201be765bdd676a18d1e38eff35de9d44c3dc15e2bfed2247e8963c9a32ae62d9ca2d6cd1edebd849aac29fdd5a846c14a30feea3edfc0601

doc/cmdlet_manual.html

Cmdlet manual

This manual shows how to deal with B0 cmdlets and create your own.

Basics

Basic operations on cmdlets are provided by the b0 cmdlet command.

b0 cmdlet list  # List cmdlets

Making your own

Let's make a simple cmdlet that invokes a script at the root of your project:

Yaddada root vs scope

let run_script ~script env args =
  let scope_dir = B0_cmdlet.Env.scope_dir env in
  let script = Fpath.(scope_dir // script) in
  let cwd = Option.value ~default:scope_dir cwd in
  Os.Exit.exec ~cwd script Cmd.(path script %% args)

let mycmd =
  B0_cmdlet.v "mycmd" ~doc:"Run mycmd" @@
  run_script ~script:(Fpath.v "scripts/mycmd")

Even though you should rewrite all these scripts as OCaml cmdlets a direct short cut for the above boilerplate is provided. Use B0_cmdlet.exec:

let mycmd =
  B0_cmdlet.v "mycmd" ~doc:"Run mycmd" @@
  B0_cmdlet.exec (Fpath.v "scripts/mycmd")
OCaml

Innovation. Community. Security.