Implements the Git.Command behaviour for git for-each-ref.
Iterates over all refs matching the given pattern(s) and formats them according to the given format string. Useful for scripting and inspecting refs programmatically.
Summary
Types
Functions
Returns the argument list for git for-each-ref.
Examples
iex> Git.Commands.ForEachRef.args(%Git.Commands.ForEachRef{})
["for-each-ref"]
iex> Git.Commands.ForEachRef.args(%Git.Commands.ForEachRef{format: "%(refname)"})
["for-each-ref", "--format=%(refname)"]
iex> Git.Commands.ForEachRef.args(%Git.Commands.ForEachRef{sort: "-creatordate", count: 5})
["for-each-ref", "--count=5", "--sort=-creatordate"]
iex> Git.Commands.ForEachRef.args(%Git.Commands.ForEachRef{sort: ["-creatordate", "refname"]})
["for-each-ref", "--sort=-creatordate", "--sort=refname"]
iex> Git.Commands.ForEachRef.args(%Git.Commands.ForEachRef{pattern: "refs/heads/"})
["for-each-ref", "refs/heads/"]
iex> Git.Commands.ForEachRef.args(%Git.Commands.ForEachRef{pattern: ["refs/heads/", "refs/tags/"]})
["for-each-ref", "refs/heads/", "refs/tags/"]
@spec parse_output(String.t(), non_neg_integer()) :: {:ok, String.t()} | {:error, {String.t(), non_neg_integer()}}
Parses the output of git for-each-ref.
On success (exit code 0), returns {:ok, output} where output is the
trimmed string. On failure, returns {:error, {stdout, exit_code}}.