internal

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandPath

func ExpandPath(path string) (string, error)

ExpandPath expands the ~ in paths to the absolute home directory path.

func LinkPackages

func LinkPackages(opts LinkOptions, logger *logging.Logger) error

LinkPackages creates symlinks for all specified packages

func RunScripts

func RunScripts(opts SetupOptions, logger *logging.Logger) error

RunScripts runs the specified setup scripts

func UnlinkPackage

func UnlinkPackage(pkgName string, cfg *Config, logger *logging.Logger) error

UnlinkPackage removes symlinks for a single package

func UnlinkPackages

func UnlinkPackages(opts UnlinkOptions, logger *logging.Logger) error

UnlinkPackages removes symlinks for all specified packages

Types

type ConditionSet

type ConditionSet struct {
	OS                []string          `yaml:"os"`
	Distro            []string          `yaml:"distro"`
	Executable        []string          `yaml:"executable"`
	ExecutableVersion map[string]string `yaml:"executable_version"`
	User              []string          `yaml:"user"`
}

type Config

type Config struct {
	SourceDir      string                    `yaml:"source_dir"`
	TargetDir      string                    `yaml:"target_dir"`
	BackupDir      string                    `yaml:"backup_dir"`
	Force          bool                      `yaml:"force"`
	Verbose        bool                      `yaml:"verbose"`
	DryRun         bool                      `yaml:"dry_run"`
	Packages       map[string]*PackageConfig `yaml:"link_overrides"`
	IgnorePackages []string                  `yaml:"ignore_packages"`
}

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration

func LoadConfig

func LoadConfig(configPath string, logger *logging.Logger) (*Config, error)

LoadConfig loads configuration from the specified file If the file doesn't exist, returns default config

func (*Config) GetBackupPath

func (c *Config) GetBackupPath(packageName, relativePath string) (string, error)

GetBackupPath returns the path where a file should be backed up

func (*Config) GetEffectiveConfig

func (c *Config) GetEffectiveConfig(packageName, relativePath string) *FileConfig

GetEffectiveConfig returns the effective configuration for a specific file by merging global, package-level, and file-specific settings

func (*Config) GetSourcePath

func (c *Config) GetSourcePath(packageName string) (string, error)

GetSourcePath returns the full path for a source package

func (*Config) GetTargetPath

func (c *Config) GetTargetPath(packageName, relativePath string) (string, error)

GetTargetPath returns the full path for a target in the target directory

func (*Config) IsDryRun

func (c *Config) IsDryRun(packageName, relativePath string) bool

IsDryRun returns whether dry run mode is enabled for a specific file

func (*Config) MatchesConditions

func (c *Config) MatchesConditions(conditionSet *ConditionSet, logger *logging.Logger) bool

MatchesConditions checks if the current environment matches the given conditions

func (*Config) ShouldBeVerbose

func (c *Config) ShouldBeVerbose(packageName, relativePath string) bool

ShouldBeVerbose returns whether verbose output should be enabled for a specific file

func (*Config) ShouldForce

func (c *Config) ShouldForce(packageName, relativePath string) bool

ShouldForce returns whether force mode is enabled for a specific file

func (*Config) ShouldIgnorePackage

func (c *Config) ShouldIgnorePackage(relPath string) bool

ShouldIgnorePackage checks if a package or a file should be skipped from Symlinking

type FileConfig

type FileConfig struct {
	TargetDir  string        `yaml:"target_dir"`
	TargetName string        `yaml:"target_name"`
	BackupDir  string        `yaml:"backup_dir"`
	Force      *bool         `yaml:"force"`
	Verbose    *bool         `yaml:"verbose"`
	DryRun     bool          `yaml:"dry_run"`
	Conditions *ConditionSet `yaml:"conditions"`
}

type LinkOptions

type LinkOptions struct {
	// Config is the application configuration
	Config *Config

	// Packages is the list of package names to link
	Packages []string
}

type PackageConfig

type PackageConfig struct {
	SourceDir  string                 `yaml:"source_dir"`
	TargetDir  string                 `yaml:"target_dir"`
	BackupDir  string                 `yaml:"backup_dir"`
	Force      *bool                  `yaml:"force"`
	Verbose    *bool                  `yaml:"verbose"`
	DryRun     bool                   `yaml:"dry_run"`
	Conditions *ConditionSet          `yaml:"conditions"`
	Files      map[string]*FileConfig `yaml:"file_overrides"`
}

type SetupOptions

type SetupOptions struct {
	// Config is the application configuration
	Config *Config

	// Scripts is the list of script names to run
	Scripts []string
}

SetupOptions holds the options for setup operations

type UnlinkOptions

type UnlinkOptions struct {
	// Config is the application configuration
	Config *Config

	// Packages is the list of package names to unlink
	Packages []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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