Documentation
¶
Index ¶
- Constants
- func CompletionScript(shell string) (string, error)
- type CLI
- type Detacher
- func (d *Detacher) BranchExists(branch string) bool
- func (d *Detacher) Checkout(worktreePath, branch string) error
- func (d *Detacher) CreateBranch(branch, worktreePath string) error
- func (d *Detacher) DeleteBranch(branch string) error
- func (d *Detacher) Detach(branch string, opts *Options) (*Result, error)
- func (d *Detacher) FindWorktreeForBranch(branch string) (*Worktree, error)
- func (d *Detacher) GetCurrentWorktreePath() (string, error)
- func (d *Detacher) GetSuffix() string
- func (d *Detacher) GetUncommittedFiles(worktreePath string) []string
- func (d *Detacher) HasUncommittedChanges(worktreePath string) bool
- func (d *Detacher) ListWorktrees() ([]Worktree, error)
- func (d *Detacher) LoadSuffixFromConfig()
- func (d *Detacher) Revert(branch string, opts *Options) (*Result, error)
- func (d *Detacher) SetSuffix(suffix string)
- func (d *Detacher) TempBranchName(branch string) string
- type Git
- type Options
- type Result
- type Worktree
Constants ¶
const (
// DefaultSuffix is the default suffix for temporary branches
DefaultSuffix = "__wt_detach"
)
Variables ¶
This section is empty.
Functions ¶
func CompletionScript ¶ added in v0.1.1
CompletionScript returns the shell completion script for the specified shell
Types ¶
type CLI ¶ added in v0.1.1
type CLI struct {
Branch string `arg:"" optional:"" help:"Branch name to detach or revert."`
DryRun bool `help:"Show what would be done without making changes." short:"n"`
Revert bool `help:"Revert the temporary detach." short:"r"`
Force bool `help:"Force execution even with uncommitted changes." short:"f"`
Yes bool `help:"Skip confirmation prompt." short:"y"`
Checkout bool `help:"Checkout the branch after detaching." short:"c"`
Init string `help:"Output shell completion script (bash, zsh, fish)." placeholder:"SHELL"`
Version kong.VersionFlag `help:"Show version."`
}
CLI defines the command-line interface
type Detacher ¶
type Detacher struct {
// contains filtered or unexported fields
}
Detacher handles the detach/revert operations
func (*Detacher) BranchExists ¶
BranchExists checks if a branch exists
func (*Detacher) CreateBranch ¶
CreateBranch creates a new branch at the current HEAD of a worktree
func (*Detacher) DeleteBranch ¶
DeleteBranch deletes a branch
func (*Detacher) FindWorktreeForBranch ¶
FindWorktreeForBranch finds a worktree that has the specified branch checked out It excludes the current worktree
func (*Detacher) GetCurrentWorktreePath ¶
GetCurrentWorktreePath returns the path of the current worktree
func (*Detacher) GetUncommittedFiles ¶ added in v0.1.3
GetUncommittedFiles returns a list of uncommitted files in a worktree
func (*Detacher) HasUncommittedChanges ¶
HasUncommittedChanges checks if a worktree has uncommitted changes
func (*Detacher) ListWorktrees ¶
ListWorktrees returns a list of all worktrees
func (*Detacher) LoadSuffixFromConfig ¶
func (d *Detacher) LoadSuffixFromConfig()
LoadSuffixFromConfig loads the suffix from git config
func (*Detacher) TempBranchName ¶
TempBranchName returns the temporary branch name for a given branch
type Git ¶
type Git struct{}
Git provides methods to execute git commands
type Worktree ¶
Worktree represents a git worktree
func FindWorktreeByBranch ¶
FindWorktreeByBranch finds a worktree that has the specified branch checked out It excludes the worktree at excludePath
func ParseWorktreeList ¶
ParseWorktreeList parses the output of `git worktree list --porcelain`