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

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

Supports the `-m` (message), `-a` (all), `--amend`, and `--allow-empty` flags.

# `t`

```elixir
@type t() :: %Git.Commands.Commit{
  all: boolean(),
  allow_empty: boolean(),
  amend: boolean(),
  message: String.t()
}
```

# `args`

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

Returns the argument list for `git commit`.

Builds the argument list from the struct fields. The `:message` field is
required and produces `-m <message>`. Optional flags are appended when set
to `true`.

## Examples

    iex> args = Git.Commands.Commit.args(%Git.Commands.Commit{message: "test", all: true})
    iex> args
    ["commit", "-m", "test", "-a"]

# `parse_output`

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

Parses the output of `git commit`.

On success (exit code 0), parses the output into a `Git.CommitResult`
struct. On failure, returns `{:error, {stdout, exit_code}}`.

---

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