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

Implements the `Git.Command` behaviour for `git add`.

Supports adding specific files or all changes with `--all`.

# `t`

```elixir
@type t() :: %Git.Commands.Add{all: boolean(), files: [String.t()]}
```

# `args`

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

Returns the argument list for `git add`.

When `:all` is `true`, passes `--all`. Otherwise, appends the list of
file paths to the argument list.

## Examples

    iex> Git.Commands.Add.args(%Git.Commands.Add{all: true})
    ["add", "--all"]

    iex> Git.Commands.Add.args(%Git.Commands.Add{files: ["foo.txt", "bar.txt"]})
    ["add", "foo.txt", "bar.txt"]

# `parse_output`

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

Parses the output of `git add`.

On success (exit code 0), returns `{:ok, :done}`. On failure, returns
`{:error, {stdout, exit_code}}`.

---

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