Git.Commands.Version (git v0.7.0)

Copy Markdown View Source

Implements the Git.Command behaviour for git --version.

Reports the installed git version, useful for gating on capabilities.

Summary

Functions

Returns the argument list for git --version.

Parses the output of git --version into a Git.Version struct.

Types

t()

@type t() :: %Git.Commands.Version{}

Functions

args(version)

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

Returns the argument list for git --version.

Examples

iex> Git.Commands.Version.args(%Git.Commands.Version{})
["--version"]

parse_output(stdout, exit_code)

@spec parse_output(String.t(), non_neg_integer()) ::
  {:ok, Git.Version.t()} | {:error, {String.t(), non_neg_integer()}}

Parses the output of git --version into a Git.Version struct.

On a non-zero exit code, returns {:error, {stdout, exit_code}}.