Documentation
¶
Overview ¶
Package go-git-exec provides thin wrappers for executing Git commands.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CmdResult ¶
type CmdResult struct {
// Stdout contains the standard output of the Git command (if any).
Stdout *bytes.Buffer
// Stderr contains the standard error of the Git command (if any).
Stderr *bytes.Buffer
// ExitCode is the exit code of the Git command.
ExitCode int
}
CmdResult represents the result of a Git command execution.
type GitExecutor ¶
type GitExecutor interface {
// RunGit executes a Git command with the specified arguments.
RunGit(args ...string) (*CmdResult, error)
// RunGitContext executes a Git command with the specified context and arguments.
RunGitContext(ctx context.Context, args ...string) (*CmdResult, error)
// WithLogger sets the logger to use for logging.
WithLogger(logger *slog.Logger) GitExecutor
// GetLogger returns the logger instance.
GetLogger() *slog.Logger
}
GitExecutor is an interface to execute Git commands.
type Params ¶
type Params struct {
// Logger is the logger to use for logging.
Logger *slog.Logger
// GitPath is the path to the Git executable. If empty, the Git executable is searched in the PATH.
GitPath string
// Env specifies the environment of the process.
// Each entry is of the form "key=value".
// If Env is nil, the new process uses the current process's
// environment.
// If Env contains duplicate environment keys, only the last
// value in the slice for each duplicate key is used.
// As a special case on Windows, SYSTEMROOT is always added if
// missing and not explicitly set to the empty string.
Env []string
}
Params is the parameters for creating a new GitExecutor instance.
Click to show internal directories.
Click to hide internal directories.