Implements the Git.Command behaviour for git remote.
Supports listing remotes (with or without verbose URL output), adding a new remote, and removing an existing remote.
Summary
Functions
Builds the argument list for git remote.
Parses stdout and exit code from git remote into a result.
Types
Functions
Builds the argument list for git remote.
- If
add_nameis set (withadd_url): produces["remote", "add", name, url] - If
removeis set: produces["remote", "remove", name] - Otherwise (list mode): produces
["remote"], plus"-v"whenverbose: true
@spec parse_output(String.t(), non_neg_integer()) :: {:ok, [Git.Remote.t()]} | {:ok, :done} | {:error, {String.t(), non_neg_integer()}}
Parses stdout and exit code from git remote into a result.
- List with exit code 0:
{:ok, [%Git.Remote{}]}(empty list when no remotes) - Add/remove with exit code 0:
{:ok, :done} - Non-zero exit code:
{:error, {stdout, exit_code}}