base

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package base provides common functionality for CM components.

Package base provides base functionality and error definitions.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Git configuration errors.
	ErrGitConfiguration = errors.New("git configuration error")

	// Worktree directory errors.
	ErrFailedToCheckWorktreeDirectoryExists = errors.New("failed to check if worktree directory exists")
	ErrFailedToRemoveWorktreeDirectory      = errors.New("failed to remove worktree directory")
)

Error definitions for base package.

Functions

This section is empty.

Types

type Base

type Base struct {
	FS            fs.FS
	Git           git.Git
	Config        *config.Config
	StatusManager status.Manager
	Logger        logger.Logger
	Prompt        prompt.Prompt
	// contains filtered or unexported fields
}

Base provides common functionality for CM components.

func NewBase

func NewBase(params NewBaseParams) *Base

NewBase creates a new Base instance.

func (*Base) BuildWorktreePath

func (b *Base) BuildWorktreePath(repoURL, remoteName, branch string) string

BuildWorktreePath constructs a worktree path from base path, repository URL, remote name, and branch.

func (*Base) CleanupWorktreeDirectory

func (b *Base) CleanupWorktreeDirectory(worktreePath string) error

CleanupWorktreeDirectory removes the worktree directory.

func (*Base) IsVerbose

func (b *Base) IsVerbose() bool

IsVerbose returns whether verbose mode is enabled.

func (*Base) ValidateGitConfiguration

func (b *Base) ValidateGitConfiguration(workDir string) error

ValidateGitConfiguration validates that Git configuration is functional.

func (*Base) VerbosePrint

func (b *Base) VerbosePrint(msg string, args ...interface{})

VerbosePrint prints a formatted message only in verbose mode.

type NewBaseParams

type NewBaseParams struct {
	FS            fs.FS
	Git           git.Git
	Config        *config.Config
	StatusManager status.Manager
	Logger        logger.Logger
	Prompt        prompt.Prompt
	Verbose       bool
}

NewBaseParams contains parameters for creating a new Base instance.

Jump to

Keyboard shortcuts

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