Implements the Git.Command behaviour for git switch.
git switch is the modern (Git 2.23+) command for switching branches,
replacing the branch-switching role of git checkout. It is more focused
and less error-prone than checkout for branch operations.
Summary
Types
Functions
Returns the argument list for git switch.
Examples
iex> Git.Commands.Switch.args(%Git.Commands.Switch{branch: "main"})
["switch", "main"]
iex> Git.Commands.Switch.args(%Git.Commands.Switch{branch: "feat/new", create: true})
["switch", "-c", "feat/new"]
iex> Git.Commands.Switch.args(%Git.Commands.Switch{branch: "abc123", detach: true})
["switch", "--detach", "abc123"]
@spec parse_output(String.t(), non_neg_integer()) :: {:ok, Git.Checkout.t()} | {:ok, :done} | {:error, {String.t(), non_neg_integer()}}
Parses the output of git switch.
Reuses Git.Checkout parsing since the output format is the same
(e.g. "Switched to branch 'main'").