# `GitHoox`
[🔗](https://github.com/sgerrand/git_hoox/blob/v0.1.0/lib/git_hoox.ex#L1)

Git hooks in pure Elixir. Configurable file globs, per-hook options,
built-in support for `mix format`, Credo, ExUnit, and Dialyzer.

## Quickstart

    mix git_hoox.install

Add hooks in `.git_hoox.exs`:

    %{
      hooks: [
        pre_commit: [
          {GitHoox.Hooks.Format, []},
          {GitHoox.Hooks.Credo, []}
        ]
      ]
    }

See `GitHoox.Hook` for writing custom hooks.

# `config`

```elixir
@type config() :: %{
  hooks: keyword(),
  parallel: boolean(),
  fail_fast: boolean(),
  skip_env: String.t()
}
```

Loaded and validated config.

# `glob`

```elixir
@type glob() :: String.t()
```

Glob pattern matched against repo-relative paths.

# `hook_entry`

```elixir
@type hook_entry() :: {module(), keyword()}
```

Hook entry in config: `{Module, keyword_opts}`.

# `hook_result`

```elixir
@type hook_result() :: :ok | {:ok, modified :: [path()]} | :skip | {:error, term()}
```

Result of a single hook invocation.

# `path`

```elixir
@type path() :: String.t()
```

Repo-relative file path.

# `stage`

```elixir
@type stage() ::
  :pre_commit
  | :prepare_commit_msg
  | :commit_msg
  | :post_commit
  | :pre_rebase
  | :post_checkout
  | :post_merge
  | :pre_push
```

Git lifecycle stage. See `git help hooks`.

# `run`

```elixir
@spec run(stage(), [String.t()], String.t() | nil) ::
  :ok | {:error, [{module(), term()}]}
```

Execute all hooks configured for `stage`.

`args` are the positional arguments the git shim received (e.g. the
commit message file path for `commit_msg`). `stdin` is the raw input
passed to the shim, only meaningful for `pre_push`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
