# `Git.Command`
[🔗](https://github.com/joshrotenberg/git_wrapper_ex/blob/main/lib/git/command.ex#L1)

Behaviour and runner for git commands.

Modules implementing this behaviour define how to build argument lists
for a specific git subcommand and how to parse the resulting output.

# `args`

```elixir
@callback args(command :: struct()) :: [String.t()]
```

Returns the argument list for this command.

# `parse_output`

```elixir
@callback parse_output(stdout :: String.t(), exit_code :: non_neg_integer()) ::
  {:ok, term()} | {:error, term()}
```

Parses the stdout and exit code from the git process into a result.

# `run`

```elixir
@spec run(module(), struct(), Git.Config.t()) :: {:ok, term()} | {:error, term()}
```

Runs a git command.

Takes a module implementing the `Git.Command` behaviour, a command
struct, and a `Git.Config`. Builds the full argument list, executes
git via `System.cmd/3`, and delegates parsing to the command module.

If the command exceeds the configured timeout, returns `{:error, :timeout}`.

## Examples

    Git.Command.run(Git.Commands.Status, %Git.Commands.Status{}, config)

---

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