Bier.CLI (bier v0.1.0)

Copy Markdown View Source

Command-line interface for running Bier as a standalone, drop-in PostgREST-compatible service.

run/2 is the pure core: it takes argv plus an explicit environment and returns %{stdout, stderr, exit} for terminal commands, or {:boot, resolved} for the default run-the-server action. It performs no IO and never halts — the conformance suite drives it directly. main/1 (added separately) is the escript wrapper that supplies real IO and System.halt/1.

Summary

Functions

escript entry point. Supplies the real process environment, writes the command's output to stdout/stderr, and halts with its exit code. For the default run action it boots one standalone Bier instance and blocks.

Run the CLI core. opts[:env] is a %{"PGRST_*" => string} map (defaults to an empty map). Returns a %{stdout, stderr, exit} map for terminal commands, {:boot, resolved} for the default run-the-server action, or {:ready, url} when --ready resolved to a URL to probe (main/1 performs the request via Bier.CLI.Ready.check/1).

Types

result()

@type result() :: %{stdout: iodata(), stderr: iodata(), exit: non_neg_integer()}

Functions

main(argv)

@spec main([String.t()]) :: no_return()

escript entry point. Supplies the real process environment, writes the command's output to stdout/stderr, and halts with its exit code. For the default run action it boots one standalone Bier instance and blocks.

run(argv, opts \\ [])

@spec run(
  [String.t()],
  keyword()
) :: result() | {:boot, map()} | {:ready, String.t()}

Run the CLI core. opts[:env] is a %{"PGRST_*" => string} map (defaults to an empty map). Returns a %{stdout, stderr, exit} map for terminal commands, {:boot, resolved} for the default run-the-server action, or {:ready, url} when --ready resolved to a URL to probe (main/1 performs the request via Bier.CLI.Ready.check/1).