Reference :telemetry handler that prints coloured hook status to the
terminal.
Sibling of GitHoox.Logger: same events, but writes plain IO lines
(no log levels, no timestamps, no Logger config) so the output reads
as a status report rather than a log. Attach it before running hooks:
GitHoox.Reporter.attach()mix git_hoox.run attaches it by default; set config :git_hoox, reporter: false to opt out. Detach with GitHoox.Reporter.detach/0.
Output looks like:
→ pre-commit · 3 hooks · 5 files
▸ Format
✓ Format · 38ms
▸ Credo
✗ Credo · exit 1 · 1.4s
- Test · skipped (no matched files)
✗ pre-commit · 1/3 failed · 1.5sStages with no configured hooks print nothing (every commit fires several shims; without this they would all emit noise).
Colour
Colour is decided once at attach/0 and fixed for the handler's life.
Precedence, first match wins:
GIT_HOOX_COLOR=always→ on,=never→ off.NO_COLORset (any value) → off.CLICOLOR_FORCE/FORCE_COLORset and not"0"→ on.IO.ANSI.enabled?/0— true on a TTY, false through a pipe.
Pass attach(color: true) / attach(color: false) to override the
detection (used by tests).
Summary
Functions
@spec attach(keyword()) :: :ok | {:error, :already_exists}
Attach the handler.
Options:
:color— force colour on/off, skipping environment detection.
@spec detach() :: :ok | {:error, :not_found}
Detach the handler. Safe to call when not attached.