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

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

Supports initializing a new repository at an optional path, with an optional
`--bare` flag for creating a bare repository.

# `t`

```elixir
@type t() :: %Git.Commands.Init{bare: boolean(), path: String.t() | nil}
```

# `args`

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

Returns the argument list for `git init`.

When `:bare` is `true`, passes `--bare`. When `:path` is set, appends it
as the final argument.

## Examples

    iex> Git.Commands.Init.args(%Git.Commands.Init{})
    ["init"]

    iex> Git.Commands.Init.args(%Git.Commands.Init{bare: true})
    ["init", "--bare"]

    iex> Git.Commands.Init.args(%Git.Commands.Init{path: "/tmp/repo"})
    ["init", "/tmp/repo"]

    iex> Git.Commands.Init.args(%Git.Commands.Init{bare: true, path: "/tmp/repo.git"})
    ["init", "--bare", "/tmp/repo.git"]

# `parse_output`

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

Parses the output of `git init`.

On success (exit code 0), returns `{:ok, :done}`. On failure, returns
`{:error, {stdout, exit_code}}`.

---

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