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

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

Supports removing tracked files from the index and optionally from the
working tree, with options for cached-only removal, force, recursive,
dry-run, quiet output, and pathspec-from-file.

# `t`

```elixir
@type t() :: %Git.Commands.Rm{
  cached: boolean(),
  dry_run: boolean(),
  files: [String.t()],
  force: boolean(),
  pathspec_from_file: String.t() | nil,
  quiet: boolean(),
  recursive: boolean()
}
```

# `args`

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

Returns the argument list for `git rm`.

Builds `git rm [options] [--] <files>` from the struct fields.

## Examples

    iex> Git.Commands.Rm.args(%Git.Commands.Rm{files: ["a.txt"]})
    ["rm", "a.txt"]

    iex> Git.Commands.Rm.args(%Git.Commands.Rm{files: ["a.txt"], cached: true})
    ["rm", "--cached", "a.txt"]

    iex> Git.Commands.Rm.args(%Git.Commands.Rm{files: ["dir/"], recursive: true, force: true})
    ["rm", "-f", "-r", "dir/"]

    iex> Git.Commands.Rm.args(%Git.Commands.Rm{files: [], pathspec_from_file: "paths.txt"})
    ["rm", "--pathspec-from-file", "paths.txt"]

# `parse_output`

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

Parses the output of `git rm`.

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*
