Squidie.Operations.CLI (squidie v0.3.7)

Copy Markdown View Source

Starts only the configured repository boundary needed by operational Mix tasks.

It avoids starting the complete host supervision tree and sanitizes errors before they reach operator-facing task output.

Summary

Functions

Runs a doctor callback even when configuration is invalid so it can report that finding.

Formats an operational error without exposing repository configuration or exception details.

Parses strict Mix task options and raises with the task name when arguments are invalid.

Runs a status callback after validating configuration and briefly starting its Ecto repo.

Runs a callback with warning-only logging for JSON output and restores the prior level.

Functions

diagnose(fun)

@spec diagnose((-> {:ok, map()} | {:error, term()})) ::
  {:ok, map()} | {:error, term()}

Runs a doctor callback even when configuration is invalid so it can report that finding.

format_error(arg1)

@spec format_error(term()) :: String.t()

Formats an operational error without exposing repository configuration or exception details.

parse_options!(task_name, args, switches)

@spec parse_options!(String.t(), [String.t()], keyword()) :: keyword()

Parses strict Mix task options and raises with the task name when arguments are invalid.

run(fun)

@spec run((-> {:ok, map()} | {:error, term()})) :: {:ok, map()} | {:error, term()}

Runs a status callback after validating configuration and briefly starting its Ecto repo.

with_json_log_level(opts, fun)

@spec with_json_log_level(
  keyword(),
  (-> result)
) :: result
when result: var

Runs a callback with warning-only logging for JSON output and restores the prior level.