Documentation
¶
Index ¶
- func PromptForConfirmation(prompt string) bool
- type CommandExecutor
- type FileConflict
- type FileOperations
- func (f *FileOperations) CopyLayer(layerPath, targetPath string, projectRoot string, ...) error
- func (f *FileOperations) DetectConflicts(layerPath, targetPath string) ([]FileConflict, error)
- func (f *FileOperations) IsIgnored(relativePath string) bool
- func (f *FileOperations) LoadIgnorePatterns(projectRoot string) error
- type GitOperations
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PromptForConfirmation ¶ added in v0.5.0
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
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