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

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

Uses ASCII control characters as delimiters in `--format` for reliable
parsing of reflog entries into `Git.ReflogEntry` structs.

# `t`

```elixir
@type t() :: %Git.Commands.Reflog{
  all: boolean(),
  date: String.t() | nil,
  dry_run: boolean(),
  expire: boolean(),
  expire_time: String.t() | nil,
  max_count: non_neg_integer() | nil,
  ref: String.t() | nil
}
```

# `args`

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

Returns the argument list for `git reflog`.

Show mode uses `--format` with ASCII control characters for reliable
structured parsing. The format string produces records separated by RS
(\x1e) with fields separated by US (\x1f). Expire mode (`:expire`) runs
`git reflog expire` instead and returns `{:ok, :done}`.

## Examples

    iex> args = Git.Commands.Reflog.args(%Git.Commands.Reflog{})
    iex> hd(args)
    "reflog"

    iex> args = Git.Commands.Reflog.args(%Git.Commands.Reflog{max_count: 5})
    iex> Enum.member?(args, "-n5")
    true

    iex> Git.Commands.Reflog.args(%Git.Commands.Reflog{expire: true, expire_time: "now", all: true})
    ["reflog", "expire", "--expire=now", "--all"]

    iex> Git.Commands.Reflog.args(%Git.Commands.Reflog{expire: true, expire_time: "30.days", ref: "refs/notes/agents"})
    ["reflog", "expire", "--expire=30.days", "refs/notes/agents"]

# `parse_output`

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

Parses the output of `git reflog`.

For show mode, returns `{:ok, [%Git.ReflogEntry{}]}`. For expire mode,
returns `{:ok, :done}`. On failure, returns `{:error, {stdout, exit_code}}`.

---

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