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

Implements the `Git.Command` behaviour for `git interpret-trailers`.

Adds or parses trailers in commit messages. Trailers are key-value pairs
that appear at the end of a commit message, such as "Signed-off-by:" or
"Co-authored-by:".

# `t`

```elixir
@type t() :: %Git.Commands.InterpretTrailers{
  file: String.t() | nil,
  if_exists: String.t() | nil,
  if_missing: String.t() | nil,
  in_place: boolean(),
  no_divider: boolean(),
  parse: boolean(),
  trailers: [String.t()],
  trim_empty: boolean(),
  unfold: boolean(),
  where: String.t() | nil
}
```

# `args`

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

Returns the argument list for `git interpret-trailers`.

## Examples

    iex> Git.Commands.InterpretTrailers.args(%Git.Commands.InterpretTrailers{})
    ["interpret-trailers"]

    iex> Git.Commands.InterpretTrailers.args(%Git.Commands.InterpretTrailers{parse: true})
    ["interpret-trailers", "--only-trailers"]

    iex> Git.Commands.InterpretTrailers.args(%Git.Commands.InterpretTrailers{trailers: ["Signed-off-by: A"]})
    ["interpret-trailers", "--trailer", "Signed-off-by: A"]

    iex> Git.Commands.InterpretTrailers.args(%Git.Commands.InterpretTrailers{in_place: true, file: "msg.txt"})
    ["interpret-trailers", "--in-place", "msg.txt"]

    iex> Git.Commands.InterpretTrailers.args(%Git.Commands.InterpretTrailers{where: "end"})
    ["interpret-trailers", "--where", "end"]

    iex> Git.Commands.InterpretTrailers.args(%Git.Commands.InterpretTrailers{if_exists: "replace"})
    ["interpret-trailers", "--if-exists", "replace"]

    iex> Git.Commands.InterpretTrailers.args(%Git.Commands.InterpretTrailers{if_missing: "doNothing"})
    ["interpret-trailers", "--if-missing", "doNothing"]

# `parse_output`

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

Parses the output of `git interpret-trailers`.

On success (exit code 0), returns `{:ok, output}` with the processed
message or trailer text. On failure, returns `{:error, {stdout, exit_code}}`.

---

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