# `Git.Commands.CheckIgnore`
[🔗](https://github.com/joshrotenberg/git_wrapper_ex/blob/main/lib/git/commands/check_ignore.ex#L1)

Implements the `Git.Command` behaviour for `git check-ignore`.

Checks whether given paths are ignored by `.gitignore` rules. Supports
verbose output showing which pattern matched and non-matching mode.

Stdin mode (`--stdin`) is intentionally not supported because it requires
stdin piping which cannot be driven programmatically via `System.cmd/3`.

# `t`

```elixir
@type t() :: %Git.Commands.CheckIgnore{
  no_index: boolean(),
  non_matching: boolean(),
  paths: [String.t()],
  quiet: boolean(),
  verbose: boolean()
}
```

# `args`

```elixir
@spec args(t()) :: [String.t()]
```

Returns the argument list for `git check-ignore`.

## Examples

    iex> Git.Commands.CheckIgnore.args(%Git.Commands.CheckIgnore{paths: ["build/", "tmp.log"]})
    ["check-ignore", "build/", "tmp.log"]

    iex> Git.Commands.CheckIgnore.args(%Git.Commands.CheckIgnore{paths: ["foo"], verbose: true})
    ["check-ignore", "-v", "foo"]

    iex> Git.Commands.CheckIgnore.args(%Git.Commands.CheckIgnore{paths: ["foo"], verbose: true, non_matching: true})
    ["check-ignore", "-v", "-n", "foo"]

    iex> Git.Commands.CheckIgnore.args(%Git.Commands.CheckIgnore{paths: ["foo"], no_index: true})
    ["check-ignore", "--no-index", "foo"]

    iex> Git.Commands.CheckIgnore.args(%Git.Commands.CheckIgnore{paths: ["foo"], quiet: true})
    ["check-ignore", "-q", "foo"]

# `parse_output`

```elixir
@spec parse_output(String.t(), non_neg_integer()) ::
  {:ok, [String.t()] | [map()]} | {:error, {String.t(), non_neg_integer()}}
```

Parses the output of `git check-ignore`.

- Default mode: returns `{:ok, [String.t()]}` with the list of ignored paths.
- Verbose mode: returns `{:ok, [map]}` where each map has `:source`,
  `:line_number`, `:pattern`, and `:path` keys.
- Exit code 1 means no paths matched, which returns `{:ok, []}` (not an error).

---

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