command

package
v2.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package command provides helpers to build and execute git commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Name    string   // Command name (e.g., "git")
	Args    []string // Command arguments
	WorkDir string   // Optional working directory
}

Command represents a shell command to be executed

func GitBranchDelete

func GitBranchDelete(branchName string, force bool) Command

GitBranchDelete builds a git branch delete command

func GitWorktreeAdd

func GitWorktreeAdd(path, commitish string, opts GitWorktreeAddOptions) Command

GitWorktreeAdd builds a git worktree add command

func GitWorktreeList

func GitWorktreeList() Command

GitWorktreeList builds a git worktree list command

func GitWorktreeRemove

func GitWorktreeRemove(path string, force bool) Command

GitWorktreeRemove builds a git worktree remove command

type ExecutionResult

type ExecutionResult struct {
	Results []Result
}

ExecutionResult represents the result of executing multiple commands

type Executor

type Executor interface {
	Execute(commands []Command) (*ExecutionResult, error)
}

Executor interface defines how commands are executed

func NewExecutor

func NewExecutor(shell ShellExecutor) Executor

NewExecutor creates a new command executor with the given shell executor

func NewRealExecutor

func NewRealExecutor() Executor

NewRealExecutor creates a new command executor with real shell execution

type GitWorktreeAddOptions

type GitWorktreeAddOptions struct {
	Force  bool
	Detach bool
	Branch string
	Track  string
}

GitWorktreeAddOptions represents options for git worktree add command

type Result

type Result struct {
	Command Command
	Output  string
	Error   error
}

Result represents the result of a single command execution

type ShellExecutor

type ShellExecutor interface {
	Execute(name string, args []string, workDir string) (string, error)
}

ShellExecutor interface abstracts the actual command execution

func NewRealShellExecutor

func NewRealShellExecutor() ShellExecutor

NewRealShellExecutor creates a new shell executor that executes real commands

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL