The behaviour of every mix juggernaut* task (design notes §3, §14).
A task is thin: it declares its flags (cli/0, see Juggernaut.CLI.Options) and
turns parsed options into an outcome (execute/3). Juggernaut.CLI.main/2 does the
rest: parsing, --help, error reporting in the requested format and the exit code.
ctx carries the environment and the project root, so tasks are tested without
touching the real process environment, and optionally plan_opts for
Juggernaut.Plan.resolve/3 (tests pass their own git runner).
Summary
Types
Optional keys: ansi, whether human output may be coloured; tty, whether stderr is a
terminal (the live progress line is redrawn); progress, called with each stderr line
when stderr is not a terminal; pool, the server's pool provider (Juggernaut.Engine).
Callbacks
The task's option spec (Juggernaut.CLI.Options).
Runs the task with parsed options and positional arguments.
Types
@type ctx() :: %{ :env => %{required(String.t()) => String.t()}, :root => Path.t(), optional(:plan_opts) => keyword(), optional(:argv) => [String.t()], optional(:ansi) => boolean(), optional(:tty) => boolean(), optional(:progress) => (String.t() -> term()), optional(:pool) => (map() -> {:ok, pid()} | {:error, Juggernaut.Error.t()}) }
Optional keys: ansi, whether human output may be coloured; tty, whether stderr is a
terminal (the live progress line is redrawn); progress, called with each stderr line
when stderr is not a terminal; pool, the server's pool provider (Juggernaut.Engine).
@type outcome() :: :ok | {:ok, Juggernaut.CLI.ExitCode.t()} | {:error, Juggernaut.Error.t()}