cli

package
v1.45.1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFromBranch

func CreateFromBranch(ctx context.Context, gitSvc gitService, cfg *config.AppConfig, branchName, worktreeName string, withChange, silent bool) (string, error)

CreateFromBranch creates a worktree from a branch name.

func CreateFromBranchWithFS added in v1.30.0

func CreateFromBranchWithFS(ctx context.Context, gitSvc gitService, cfg *config.AppConfig, branchName, worktreeName string, withChange, silent bool, fs OSFilesystem) (string, error)

CreateFromBranchWithFS creates a worktree from a branch name using the provided filesystem.

func CreateFromIssue added in v1.34.0

func CreateFromIssue(ctx context.Context, gitSvc gitService, cfg *config.AppConfig, issueNumber int, baseBranch string, noWorkspace, silent bool) (string, error)

CreateFromIssue creates a worktree from an issue number.

func CreateFromIssueWithFS added in v1.34.0

func CreateFromIssueWithFS(ctx context.Context, gitSvc gitService, cfg *config.AppConfig, issueNumber int, baseBranch string, noWorkspace, silent bool, fs OSFilesystem) (string, error)

CreateFromIssueWithFS creates a worktree from an issue number using the provided filesystem.

func CreateFromPR

func CreateFromPR(ctx context.Context, gitSvc gitService, cfg *config.AppConfig, prNumber int, noWorkspace, silent bool) (string, error)

CreateFromPR creates a worktree from a PR number.

func CreateFromPRWithFS added in v1.30.0

func CreateFromPRWithFS(ctx context.Context, gitSvc gitService, cfg *config.AppConfig, prNumber int, noWorkspace, silent bool, fs OSFilesystem) (string, error)

CreateFromPRWithFS creates a worktree from a PR number using the provided filesystem.

func DeleteWorktree

func DeleteWorktree(ctx context.Context, gitSvc gitService, cfg *config.AppConfig, worktreePath string, deleteBranch, silent bool) error

DeleteWorktree deletes a worktree. If worktreePath is empty, lists available worktrees.

func FindWorktreeByPathOrName added in v1.37.0

func FindWorktreeByPathOrName(pathOrName string, worktrees []*models.WorktreeInfo, worktreeDir, repoName, mainWorktreePath string) (*models.WorktreeInfo, error)

FindWorktreeByPathOrName finds a worktree by its path or name.

func IsRepoLocal added in v1.45.1

func IsRepoLocal(worktreeDir, mainWorktreePath string) bool

IsRepoLocal reports whether worktreeDir is inside mainWorktreePath, indicating that worktrees are stored within the repository itself.

func NoteEdit added in v1.42.0

func NoteEdit(ctx context.Context, gitSvc gitService, cfg *config.AppConfig, worktreePathOrName, inputFile string) error

NoteEdit edits the note for a worktree. If inputFile is "-", reads from stdin. If inputFile is non-empty, reads from that file. Otherwise opens $EDITOR.

func NoteGet added in v1.44.0

func NoteGet(ctx context.Context, gitSvc gitService, cfg *config.AppConfig, worktreePathOrName string) (*models.WorktreeNote, string, error)

NoteGet retrieves the note for a worktree without printing it. Returns the note (empty if none exists), the worktree path, and any error.

func NoteSet added in v1.44.0

func NoteSet(ctx context.Context, gitSvc gitService, cfg *config.AppConfig, worktreePathOrName string, note models.WorktreeNote) error

NoteSet writes note metadata for a worktree without opening an editor. Only non-zero fields in note are applied; existing fields not mentioned are preserved.

func NoteShow added in v1.42.0

func NoteShow(ctx context.Context, gitSvc gitService, cfg *config.AppConfig, worktreePathOrName string) error

NoteShow prints the note text for a worktree to stdout.

func RenameWorktree added in v1.37.0

func RenameWorktree(ctx context.Context, gitSvc gitService, cfg *config.AppConfig, worktreePath, newName string, silent bool) error

RenameWorktree renames a worktree. The branch is renamed only when the current worktree name and branch name are the same.

func SelectIssueInteractive added in v1.34.0

func SelectIssueInteractive(ctx context.Context, gitSvc gitService, query string, stdin io.Reader, stderr io.Writer) (int, error)

SelectIssueInteractive presents an interactive issue selector (fzf when available, numbered list otherwise).

func SelectIssueInteractiveFromStdio added in v1.34.0

func SelectIssueInteractiveFromStdio(ctx context.Context, gitSvc gitService, query string) (int, error)

SelectIssueInteractiveFromStdio wraps SelectIssueInteractive with os.Stdin/os.Stderr.

func SelectPRInteractive added in v1.34.0

func SelectPRInteractive(ctx context.Context, gitSvc gitService, query string, stdin io.Reader, stderr io.Writer) (int, error)

SelectPRInteractive presents an interactive PR selector (fzf when available, numbered list otherwise).

func SelectPRInteractiveFromStdio added in v1.34.0

func SelectPRInteractiveFromStdio(ctx context.Context, gitSvc gitService, query string) (int, error)

SelectPRInteractiveFromStdio wraps SelectPRInteractive with os.Stdin/os.Stderr.

Types

type OSFilesystem added in v1.30.0

type OSFilesystem interface {
	Stat(name string) (os.FileInfo, error)
	MkdirAll(path string, perm os.FileMode) error
	Getwd() (string, error)
}

OSFilesystem abstracts filesystem operations for dependency injection.

var DefaultFS OSFilesystem = RealFilesystem{}

DefaultFS is the default filesystem implementation using the real os package.

type RealFilesystem added in v1.30.0

type RealFilesystem struct{}

RealFilesystem implements OSFilesystem using the real os package.

func (RealFilesystem) Getwd added in v1.30.0

func (RealFilesystem) Getwd() (string, error)

Getwd wraps os.Getwd.

func (RealFilesystem) MkdirAll added in v1.30.0

func (RealFilesystem) MkdirAll(path string, perm os.FileMode) error

MkdirAll wraps os.MkdirAll.

func (RealFilesystem) Stat added in v1.30.0

func (RealFilesystem) Stat(name string) (os.FileInfo, error)

Stat wraps os.Stat.

Jump to

Keyboard shortcuts

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