package b0

  1. Overview
  2. Docs
Software construction and deployment kit

Install

Dune Dependency

Authors

Maintainers

Sources

b0-0.0.3.tbz
sha512=d24b09eb520b8b91a1e5715badc9f5bcd6a6ec49c047f719a07afef6b835c128dc63e00c3be73d5353b037f4c3c9f2889e40666b30e297e872e4d011f098394c

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.