config

package
v1.2.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnabledFeatureNames

func GetEnabledFeatureNames(features []*Feature) []string

GetEnabledFeatureNames returns a list of enabled feature names

func IsFeatureEnabled

func IsFeatureEnabled(features []*Feature, name string) bool

IsFeatureEnabled checks if a feature with the given name is enabled

Types

type Feature

type Feature struct {
	Name          string   // Derived from filename (e.g., "devel" from "devel.feature")
	FilePath      string   // Path to the .feature file
	Description   string   // Human-readable description
	Documentation string   // URL to documentation
	AppStream     string   // URL to AppStream catalog XML
	Enabled       bool     // Whether the feature is enabled
	Masked        bool     // Whether the feature is masked (symlink to /dev/null)
	Transfers     []string // Names of transfers belonging to this feature
}

Feature represents a parsed .feature configuration file

func LoadFeatures

func LoadFeatures(customPath string) ([]*Feature, error)

LoadFeatures loads all .feature files from the specified directory or default paths

type SourceSection

type SourceSection struct {
	Type          string   // Source type (url-file, url-tar, etc.)
	Path          string   // Base URL or path
	MatchPattern  string   // Primary pattern with @v placeholder for version (first pattern)
	MatchPatterns []string // All patterns (for matching different compression formats)
}

SourceSection represents the [Source] section of a .transfer file

func (SourceSection) Patterns

func (s SourceSection) Patterns() []string

Patterns returns MatchPatterns if non-empty, falling back to []string{MatchPattern} if MatchPattern is set. Returns nil when both are empty.

type TargetSection

type TargetSection struct {
	Type           string   // Target type (regular-file, directory, etc.)
	Path           string   // Target directory path
	MatchPattern   string   // Primary pattern with @v placeholder for version (first pattern)
	MatchPatterns  []string // All patterns (for matching different compression formats)
	CurrentSymlink string   // Name of symlink pointing to current version
	Mode           uint32   // File mode (e.g., 0644)
	ReadOnly       bool     // Whether to set read-only flag
}

TargetSection represents the [Target] section of a .transfer file

func (TargetSection) Patterns

func (t TargetSection) Patterns() []string

Patterns returns MatchPatterns if non-empty, falling back to []string{MatchPattern} if MatchPattern is set. Returns nil when both are empty.

type Transfer

type Transfer struct {
	Component string          // Derived from filename
	FilePath  string          // Path to the .transfer file
	Transfer  TransferSection // [Transfer] section
	Source    SourceSection   // [Source] section
	Target    TargetSection   // [Target] section
}

Transfer represents a parsed .transfer configuration file

func FilterTransfersByFeatures

func FilterTransfersByFeatures(transfers []*Transfer, features []*Feature) []*Transfer

FilterTransfersByFeatures filters transfers based on enabled features. A transfer is included if: - It has no Features and no RequisiteFeatures (standalone, always included) - It has Features and at least one of them is enabled (OR logic) - It has RequisiteFeatures and all of them are enabled (AND logic) Both conditions must be satisfied if both are specified.

func GetTransfersForFeature

func GetTransfersForFeature(transfers []*Transfer, featureName string) []*Transfer

GetTransfersForFeature returns all transfers that belong to a specific feature

func LoadTransfers

func LoadTransfers(customPath string) ([]*Transfer, error)

LoadTransfers loads all .transfer files from the specified directory or default paths

type TransferSection

type TransferSection struct {
	MinVersion        string   // Minimum version to consider
	ProtectVersion    string   // Version to never remove (supports specifiers)
	Verify            bool     // Verify GPG signatures (default: false for this implementation)
	InstancesMax      int      // Maximum number of versions to keep (default: 2)
	Features          []string // Features this transfer belongs to (OR logic: any enabled activates)
	RequisiteFeatures []string // All of these features must be enabled (AND logic)
}

TransferSection represents the Transfer section of a .transfer file

Jump to

Keyboard shortcuts

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