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

Manage `.git/hooks/*` shim files.

Refuses to overwrite user-authored hooks. Pass `force: true` to back up
and replace. Detects own shims by `# git_hoox managed` marker.

# `action`

```elixir
@type action() :: :write | :overwrite_managed | :overwrite_with_backup
```

Per-hook installer plan entry.

# `install_error`

```elixir
@type install_error() :: :not_a_git_repo | {:exists, Path.t(), String.t()}
```

# `plan_entry`

```elixir
@type plan_entry() :: {String.t(), Path.t(), action()}
```

# `scaffold_error`

```elixir
@type scaffold_error() :: {:config_exists, Path.t()}
```

# `install`

```elixir
@spec install(keyword()) :: {:ok, [plan_entry()]} | {:error, install_error()}
```

Install hook shims into `.git/hooks/`.

## Options

  * `:force` — overwrite user hooks with backup. Default `false`.
  * `:dry_run` — print plan, no writes. Default `false`.

# `scaffold`

```elixir
@spec scaffold(keyword()) :: {:ok, Path.t()} | {:error, scaffold_error()}
```

Write a starter `.git_hoox.exs` at the repo root.

## Options

  * `:force` — overwrite existing config. Default `false`.

Returns `{:ok, path}` on success or `{:error, {:config_exists, path}}`
if the file already exists and `:force` is false.

# `uninstall`

```elixir
@spec uninstall(keyword()) :: {:ok, non_neg_integer()}
```

Remove managed shims. Restore latest backup if present.

---

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