Documentation
¶
Overview ¶
Package runner provides types for executing commands in a specific directory.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FetchRunner ¶
type FetchRunner struct {
// GitCommand is the git binary name/path. Defaults to "git" if empty.
GitCommand string
// Default fetches only the repository's default branch.
Default bool
// FetchFlags are additional arguments passed directly to "git fetch".
FetchFlags []string
// Inner executes git commands. Defaults to ProcessRunner{} if nil.
Inner Runner
}
FetchRunner handles git fetch execution across repositories.
type PathPrefixRunner ¶
type PathPrefixRunner struct {
Inner Runner
// RepoPath is the absolute path of the repository.
RepoPath string
// AbsPath controls whether output paths are absolute or relative to Root.
AbsPath bool
// Root is the repos root used to compute a relative prefix when AbsPath is false.
Root string
}
PathPrefixRunner wraps another Runner to execute a command and prefix each output line with the repository path.
When AbsPath is true the prefix is the absolute RepoPath. When AbsPath is false the prefix is RepoPath relative to Root.
type ProcessRunner ¶
type ProcessRunner struct{}
ProcessRunner executes commands as real OS processes.
type PullRunner ¶
type PullRunner struct {
// GitCommand is the git binary name/path. Defaults to "git" if empty.
GitCommand string
// SwitchDefault checks out the repository's default branch before pulling.
SwitchDefault bool
// SwitchBack restores the initial branch after pulling if SwitchDefault changed branches.
SwitchBack bool
// PullFlags are additional arguments passed directly to "git pull".
PullFlags []string
// Inner executes git commands. Defaults to ProcessRunner{} if nil.
Inner Runner
}
PullRunner handles git pull execution with optional default branch checkout and branch restoration.
type Runner ¶
type Runner interface {
Run(ctx context.Context, dir string, command []string, stdout, stderr io.Writer) error
}
Runner executes a command in dir, writing its stdout/stderr to the provided writers.
type TaskError ¶
TaskError annotates an execution error with the repository path, the executed command, and the process exit code.
type WorktreePruneRunner ¶ added in v0.4.0
type WorktreePruneRunner struct {
// GitCommand is the git binary name/path. Defaults to "git" if empty.
GitCommand string
// ReposRoot is the root directory of main repositories.
ReposRoot string
// WorktreeRoot is the root directory where worktrees are located.
WorktreeRoot string
// DryRun controls whether worktree removal and prune run in dry-run mode.
DryRun bool
// Inner executes git commands. Defaults to ProcessRunner{} if nil.
Inner Runner
}
WorktreePruneRunner prunes merged worktrees under WorktreeRoot for a repository and runs "git worktree prune".
func (*WorktreePruneRunner) Run ¶ added in v0.4.0
func (p *WorktreePruneRunner) Run(ctx context.Context, dir string, _ []string, stdout, stderr io.Writer) error
Run discovers worktrees for dir under WorktreeRoot, removes those merged into the repository's default branch, and runs "git worktree prune".