Implements the Git.Command behaviour for git clean.
Removes untracked files from the working tree. Supports force, dry-run, directory cleaning, ignored file cleaning, exclusion patterns, and quiet mode.
Interactive mode (-i) is intentionally not supported because it requires
interactive terminal input which cannot be driven programmatically.
Summary
Types
Functions
Returns the argument list for git clean.
Builds the argument list from the struct fields. At least one of :force
or :dry_run should be set, as git requires -f for actual cleaning
unless clean.requireForce is set to false.
Examples
iex> Git.Commands.Clean.args(%Git.Commands.Clean{dry_run: true})
["clean", "-n"]
iex> Git.Commands.Clean.args(%Git.Commands.Clean{force: true, directories: true})
["clean", "-f", "-d"]
iex> Git.Commands.Clean.args(%Git.Commands.Clean{force: true, ignored: true})
["clean", "-f", "-x"]
iex> Git.Commands.Clean.args(%Git.Commands.Clean{force: true, exclude: "*.log"})
["clean", "-f", "-e", "*.log"]
iex> Git.Commands.Clean.args(%Git.Commands.Clean{force: true, paths: ["src/", "tmp/"]})
["clean", "-f", "--", "src/", "tmp/"]
@spec parse_output(String.t(), non_neg_integer()) :: {:ok, [String.t()]} | {:error, {String.t(), non_neg_integer()}}
Parses the output of git clean.
On success (exit code 0), parses the output into a list of file paths
that were removed or would be removed. Lines from git clean look like
"Removing file.txt" or "Would remove file.txt".
Returns {:ok, [String.t()]} on success or
{:error, {stdout, exit_code}} on failure.