Implements the Git.Command behaviour for git tag.
Supports listing tags (default), creating a lightweight tag, creating an annotated tag, and deleting a tag.
Summary
Types
Functions
Returns the argument list for git tag.
- If
:createis set with:message, buildsgit tag -a <name> -m <msg>(annotated). - If
:createis set without:message, buildsgit tag <name>(lightweight). - If
:deleteis set, buildsgit tag -d <name>. - Otherwise, lists tags with detailed format.
Both create and delete accept an optional :ref to specify the commit.
Examples
iex> Git.Commands.Tag.args(%Git.Commands.Tag{})
["tag", "-l", "--format=" <> Git.Tag.format_string()]
iex> Git.Commands.Tag.args(%Git.Commands.Tag{create: "v1.0.0"})
["tag", "v1.0.0"]
iex> Git.Commands.Tag.args(%Git.Commands.Tag{create: "v1.0.0", message: "release 1.0"})
["tag", "-a", "v1.0.0", "-m", "release 1.0"]
iex> Git.Commands.Tag.args(%Git.Commands.Tag{delete: "v1.0.0"})
["tag", "-d", "v1.0.0"]
@spec parse_output(String.t(), non_neg_integer()) :: {:ok, [Git.Tag.t()]} | {:ok, :done} | {:error, {String.t(), non_neg_integer()}}
Parses the output of git tag.
For list operations (exit 0), parses each entry into a Git.Tag struct.
For create/delete operations (exit 0), returns {:ok, :done}.
On failure, returns {:error, {stdout, exit_code}}.