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

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

When no custom `:format` or `:oneline` option is provided, uses ASCII
control-character delimiters (the same technique as `Git.Commands.Log`)
to reliably parse the commit header into a `Git.Commit` struct, with
the remaining output captured as diff and stat text.

When a custom format is provided or `--oneline` is used, the raw output is
returned without structured commit parsing.

# `t`

```elixir
@type t() :: %Git.Commands.Show{
  abbrev_commit: boolean(),
  diff_filter: String.t() | nil,
  format: String.t() | nil,
  name_only: boolean(),
  name_status: boolean(),
  no_patch: boolean(),
  oneline: boolean(),
  quiet: boolean(),
  ref: String.t(),
  stat: boolean()
}
```

# `args`

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

Builds the argument list for `git show`.

When no custom format or oneline flag is set, injects a control-character
format string to enable structured parsing of the commit header.

## Examples

    iex> Git.Commands.Show.args(%Git.Commands.Show{})
    ["show", "--format=\x1e%H\x1f%h\x1f%an\x1f%ae\x1f%aI\x1f%s\x1f%b\x1e", "HEAD"]

    iex> Git.Commands.Show.args(%Git.Commands.Show{ref: "abc123", stat: true})
    ["show", "--format=\x1e%H\x1f%h\x1f%an\x1f%ae\x1f%aI\x1f%s\x1f%b\x1e", "--stat", "abc123"]

    iex> Git.Commands.Show.args(%Git.Commands.Show{oneline: true})
    ["show", "--oneline", "HEAD"]

    iex> Git.Commands.Show.args(%Git.Commands.Show{format: "%H %s"})
    ["show", "--format=%H %s", "HEAD"]

# `parse_output`

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

Parses the output of `git show`.

When structured mode is active (no custom format), parses the commit header
using control-character delimiters and captures the remaining output as
diff/stat text. In raw mode, wraps the full output in the result struct.

On failure, returns `{:error, {stdout, exit_code}}`.

---

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