packs

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package packs provides functionality for discovering, loading, and managing dotfile packs within the dodot system.

A pack is a directory containing dotfiles and optional configuration that defines how those files should be deployed. This package handles:

  • Pack discovery and validation
  • Pack configuration loading (.dodot.toml files)
  • Pack ignore functionality (.dodotignore files)
  • Pack filtering and selection

The package implements the core pack management logic that feeds into the dodot deployment pipeline.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPackCandidates

func GetPackCandidates(dotfilesRoot string) ([]string, error)

GetPackCandidates returns all potential pack directories in the dotfiles root Deprecated: Use GetPackCandidatesFS instead to support filesystem abstraction

IMPORTANT: Commands should NOT call this function directly. Instead, use the centralized helper core.DiscoverAndSelectPacks which properly handles pack discovery, loading, and selection in a consistent way.

func GetPackCandidatesFS added in v0.1.4

func GetPackCandidatesFS(dotfilesRoot string, filesystem types.FS) ([]string, error)

GetPackCandidatesFS returns all potential pack directories using the provided filesystem

IMPORTANT: Commands should NOT call this function directly. Instead, use the centralized helper core.DiscoverAndSelectPacks which properly handles pack discovery, loading, and selection in a consistent way.

func GetPackNames

func GetPackNames(packs []types.Pack) []string

GetPackNames returns a list of pack names

func GetPacks

func GetPacks(candidates []string) ([]types.Pack, error)

GetPacks validates and creates Pack instances from candidate paths Deprecated: Use GetPacksFS instead to support filesystem abstraction

IMPORTANT: Commands should NOT call this function directly. Instead, use the centralized helper core.DiscoverAndSelectPacks which properly handles pack discovery, loading, and selection in a consistent way.

func GetPacksFS added in v0.1.4

func GetPacksFS(candidates []string, filesystem types.FS) ([]types.Pack, error)

GetPacksFS validates and creates Pack instances from candidate paths using the provided filesystem

IMPORTANT: Commands should NOT call this function directly. Instead, use the centralized helper core.DiscoverAndSelectPacks which properly handles pack discovery, loading, and selection in a consistent way.

func LoadPackConfig

func LoadPackConfig(configPath string) (config.PackConfig, error)

LoadPackConfig reads and parses a pack's .dodot.toml configuration file

func NormalizePackName added in v0.3.0

func NormalizePackName(name string) string

NormalizePackName removes trailing slashes from a pack name. This handles cases where shell completion adds a trailing slash to directory names.

func NormalizePackNames added in v0.3.0

func NormalizePackNames(names []string) []string

NormalizePackNames removes trailing slashes from all pack names in the slice.

func SelectPacks

func SelectPacks(allPacks []types.Pack, selectedNames []string) ([]types.Pack, error)

SelectPacks filters a list of packs by name

IMPORTANT: Commands should NOT call this function directly. Instead, use the centralized helper core.DiscoverAndSelectPacks which properly handles pack discovery, loading, and selection in a consistent way.

func ShouldIgnoreDirectoryTraversal

func ShouldIgnoreDirectoryTraversal(dirPath string, relPath string) bool

ShouldIgnoreDirectoryTraversal checks if a directory should be skipped during traversal This function provides a convenient interface for file walking operations

func ShouldIgnorePack

func ShouldIgnorePack(packPath string) bool

ShouldIgnorePack checks if a pack should be ignored by checking for a .dodotignore file This function maintains backward compatibility with existing code

func ShouldIgnorePackFS added in v0.1.4

func ShouldIgnorePackFS(packPath string, filesystem types.FS) bool

ShouldIgnorePackFS checks if a pack should be ignored using the provided filesystem

func ValidatePack

func ValidatePack(packPath string) error

ValidatePack checks if a directory is a valid pack

Types

type IgnoreChecker

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

IgnoreChecker provides unified interface for checking if packs or files should be ignored

func NewIgnoreChecker

func NewIgnoreChecker() *IgnoreChecker

NewIgnoreChecker creates a new IgnoreChecker instance

func (*IgnoreChecker) HasIgnoreFile

func (ic *IgnoreChecker) HasIgnoreFile(dirPath string) bool

HasIgnoreFile checks if a directory contains a .dodotignore file

func (*IgnoreChecker) ShouldIgnoreDirectoryDuringTraversal

func (ic *IgnoreChecker) ShouldIgnoreDirectoryDuringTraversal(dirPath string, relPath string) bool

ShouldIgnoreDirectoryDuringTraversal checks if a directory should be skipped during file traversal This is used when walking through pack contents to find files

func (*IgnoreChecker) ShouldIgnorePackDirectory

func (ic *IgnoreChecker) ShouldIgnorePackDirectory(packPath string) bool

ShouldIgnorePackDirectory checks if a pack directory should be ignored due to .dodotignore file

Directories

Path Synopsis
Package commands provides Command implementations for the pack orchestration.
Package commands provides Command implementations for the pack orchestration.
Package orchestration provides orchestration for executing commands across multiple packs.
Package orchestration provides orchestration for executing commands across multiple packs.

Jump to

Keyboard shortcuts

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