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

Implements the `Git.Command` behaviour for `git ls-files`.

Lists information about files in the index and working tree.
Supports filtering by cached, deleted, modified, untracked (others),
ignored, staged, unmerged, and killed files.

# `t`

```elixir
@type t() :: %Git.Commands.LsFiles{
  abbrev: boolean() | non_neg_integer() | nil,
  cached: boolean(),
  debug: boolean(),
  deduplicate: boolean(),
  deleted: boolean(),
  error_unmatch: boolean(),
  exclude: String.t() | nil,
  exclude_from: String.t() | nil,
  exclude_standard: boolean(),
  full_name: boolean(),
  ignored: boolean(),
  killed: boolean(),
  modified: boolean(),
  others: boolean(),
  paths: [String.t()],
  stage: boolean(),
  unmerged: boolean()
}
```

# `args`

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

Returns the argument list for `git ls-files`.

Builds the argument list from the struct fields, appending boolean flags
and string options as needed. Path patterns are appended after `--`.

## Examples

    iex> Git.Commands.LsFiles.args(%Git.Commands.LsFiles{})
    ["ls-files"]

    iex> Git.Commands.LsFiles.args(%Git.Commands.LsFiles{others: true, exclude_standard: true})
    ["ls-files", "--others", "--exclude-standard"]

    iex> Git.Commands.LsFiles.args(%Git.Commands.LsFiles{modified: true, paths: ["src/"]})
    ["ls-files", "--modified", "--", "src/"]

# `parse_output`

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

Parses the output of `git ls-files`.

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

---

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