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

Implements the `Git.Command` behaviour for `git symbolic-ref`.

Reads, creates, or deletes symbolic refs. A symbolic ref is a ref
that points to another ref (e.g., HEAD typically points to a branch).

# `t`

```elixir
@type t() :: %Git.Commands.SymbolicRef{
  delete: boolean(),
  quiet: boolean(),
  ref: String.t() | nil,
  short: boolean(),
  target: String.t() | nil
}
```

# `args`

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

Returns the argument list for `git symbolic-ref`.

## Examples

    iex> Git.Commands.SymbolicRef.args(%Git.Commands.SymbolicRef{ref: "HEAD"})
    ["symbolic-ref", "HEAD"]

    iex> Git.Commands.SymbolicRef.args(%Git.Commands.SymbolicRef{ref: "HEAD", short: true})
    ["symbolic-ref", "--short", "HEAD"]

    iex> Git.Commands.SymbolicRef.args(%Git.Commands.SymbolicRef{ref: "HEAD", target: "refs/heads/main"})
    ["symbolic-ref", "HEAD", "refs/heads/main"]

    iex> Git.Commands.SymbolicRef.args(%Git.Commands.SymbolicRef{ref: "HEAD", delete: true})
    ["symbolic-ref", "--delete", "HEAD"]

    iex> Git.Commands.SymbolicRef.args(%Git.Commands.SymbolicRef{ref: "HEAD", quiet: true})
    ["symbolic-ref", "--quiet", "HEAD"]

# `parse_output`

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

Parses the output of `git symbolic-ref`.

For reads (exit code 0 with output), returns `{:ok, ref_string}` trimmed.
For writes and deletes (exit code 0 with no output), returns `{:ok, :done}`.
On failure, returns `{:error, {stdout, exit_code}}`.

---

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