util

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PromptForConfirmation added in v0.5.0

func PromptForConfirmation(prompt string) bool

PromptForConfirmation prompts the user for y/n confirmation and returns true if confirmed

Types

type CommandExecutor added in v0.4.0

type CommandExecutor struct {
	WorkingDir string
}

CommandExecutor handles executing shell commands for hooks

func NewCommandExecutor added in v0.4.0

func NewCommandExecutor(workingDir string) *CommandExecutor

NewCommandExecutor creates a new CommandExecutor

func (*CommandExecutor) ExecuteCommand added in v0.4.0

func (c *CommandExecutor) ExecuteCommand(command string) error

ExecuteCommand executes a single shell command

func (*CommandExecutor) ExecuteCommands added in v0.4.0

func (c *CommandExecutor) ExecuteCommands(commands []string, context string) error

ExecuteCommands executes a list of shell commands in sequence

func (*CommandExecutor) ExecuteCommandsWithCleanup added in v0.4.0

func (c *CommandExecutor) ExecuteCommandsWithCleanup(commands []string, context string, onError []string) error

ExecuteCommandsWithCleanup executes commands and runs cleanup on error

type FileConflict added in v0.5.0

type FileConflict struct {
	RelativePath string
	SourcePath   string
	DestPath     string
}

FileConflict tracks files that would be overwritten during a layer copy

type FileOperations

type FileOperations struct {
	IgnorePatterns []string
}

FileOperations handles file copying and ignore patterns

func NewFileOperations

func NewFileOperations() *FileOperations

NewFileOperations creates a new FileOperations instance

func (*FileOperations) CopyLayer

func (f *FileOperations) CopyLayer(layerPath, targetPath string, projectRoot string, templateVars map[string]string, delims [2]string, force bool) error

CopyLayer copies files from a layer directory to the target directory If force is false and there are file conflicts, the user will be prompted for confirmation

func (*FileOperations) DetectConflicts added in v0.5.0

func (f *FileOperations) DetectConflicts(layerPath, targetPath string) ([]FileConflict, error)

DetectConflicts scans a layer directory and returns files that would be overwritten

func (*FileOperations) IsIgnored

func (f *FileOperations) IsIgnored(relativePath string) bool

IsIgnored checks if a file path should be ignored based on ignore patterns

func (*FileOperations) LoadIgnorePatterns

func (f *FileOperations) LoadIgnorePatterns(projectRoot string) error

LoadIgnorePatterns loads ignore patterns from .otterignore file

type GitOperations

type GitOperations struct {
	// contains filtered or unexported fields
}

GitOperations handles all git-related operations

func NewGitOperations

func NewGitOperations(cacheDir string) *GitOperations

NewGitOperations creates a new GitOperations instance

func (*GitOperations) CloneOrUpdateLayer

func (g *GitOperations) CloneOrUpdateLayer(repoURL string) (string, error)

CloneOrUpdateLayer clones a git repository to the cache directory, updates it if it already exists, or returns the path directly for local layers

func (*GitOperations) GetRepoDirectoryName

func (g *GitOperations) GetRepoDirectoryName(repoURL string) string

getRepoDirectoryName creates a unique directory name for a repository URL

func (*GitOperations) GetRepositoryCommit

func (g *GitOperations) GetRepositoryCommit(localPath string) (string, error)

GetRepositoryCommit gets the current commit hash of a repository, or returns info for local layers

Jump to

Keyboard shortcuts

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