status

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseChecker

type BaseChecker struct {
	PowerUpName string
}

BaseChecker provides common functionality for all status checkers

func (bc *BaseChecker) CheckSymlink(fs filesystem.FullFileSystem, path string) (*SymlinkCheckResult, error)

CheckSymlink checks if a path is a valid symlink and returns its properties

func (*BaseChecker) CompareSymlinkTargets

func (bc *BaseChecker) CompareSymlinkTargets(expected, actual string) bool

CompareSymlinkTargets compares expected and actual symlink targets, handling both absolute and relative paths

func (*BaseChecker) HandleStatError

func (bc *BaseChecker) HandleStatError(status *types.FileStatus, err error, notExistMessage string) (*types.FileStatus, error)

HandleStatError handles common fs.Stat error cases

func (*BaseChecker) InitializeStatus

func (bc *BaseChecker) InitializeStatus(path string, defaultMessage string) *types.FileStatus

InitializeStatus creates a new FileStatus with default values

func (*BaseChecker) SetError

func (bc *BaseChecker) SetError(status *types.FileStatus, action string, err error)

SetError sets the status to error with a formatted message

func (*BaseChecker) SetSymlinkMetadata

func (bc *BaseChecker) SetSymlinkMetadata(status *types.FileStatus, result *SymlinkCheckResult, expectedTarget string)

SetSymlinkMetadata sets common symlink-related metadata

type BrewChecker

type BrewChecker struct {
	*BaseChecker
	*SentinelChecker
}

BrewChecker checks the status of Homebrew operations

func NewBrewChecker

func NewBrewChecker() *BrewChecker

NewBrewChecker creates a new Homebrew status checker

func (*BrewChecker) CheckStatus

CheckStatus checks if Homebrew packages are installed and up to date

type CheckSentinelResult

type CheckSentinelResult struct {
	Exists          bool
	StoredChecksum  string
	CurrentChecksum string
	Error           error
}

CheckSentinelResult contains the result of checking a sentinel file

type Checker

type Checker interface {
	// CheckStatus examines the current state of a file and returns its status
	CheckStatus(op *types.Operation, fs filesystem.FullFileSystem) (*types.FileStatus, error)
}

Checker defines the interface for checking the status of files managed by different PowerUps

type PathChecker

type PathChecker struct {
	BaseChecker
}

PathChecker checks the status of PATH operations

func NewPathChecker

func NewPathChecker() *PathChecker

NewPathChecker creates a new PATH status checker

func (*PathChecker) CheckStatus

CheckStatus checks if a directory is in PATH and properly deployed

type PowerUpChecker

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

PowerUpChecker provides a registry of status checkers for different PowerUps

func NewPowerUpChecker

func NewPowerUpChecker(fs filesystem.FullFileSystem) *PowerUpChecker

NewPowerUpChecker creates a new PowerUpChecker with the given filesystem

func (*PowerUpChecker) CheckOperationStatus

func (pc *PowerUpChecker) CheckOperationStatus(op *types.Operation) (*types.FileStatus, error)

CheckOperationStatus checks the status of an operation based on its PowerUp type

type ProfileChecker

type ProfileChecker struct {
	BaseChecker
}

ProfileChecker checks the status of shell profile operations

func NewProfileChecker

func NewProfileChecker() *ProfileChecker

NewProfileChecker creates a new profile status checker

func (*ProfileChecker) CheckStatus

CheckStatus checks if a shell profile entry exists

type SentinelChecker

type SentinelChecker struct {
	PowerUpName string
}

SentinelChecker provides common functionality for checking sentinel files

func NewSentinelChecker

func NewSentinelChecker(powerUpName string) *SentinelChecker

NewSentinelChecker creates a new sentinel checker

func (*SentinelChecker) CheckSentinel

func (sc *SentinelChecker) CheckSentinel(fs filesystem.FullFileSystem, sentinelPath string, op *types.Operation) *CheckSentinelResult

CheckSentinel checks if a sentinel file exists and reads its checksum

func (*SentinelChecker) ComputeSentinelPath

func (sc *SentinelChecker) ComputeSentinelPath(op *types.Operation) string

ComputeSentinelPath computes the sentinel file path based on the operation

func (*SentinelChecker) GetCurrentChecksum

func (sc *SentinelChecker) GetCurrentChecksum(op *types.Operation) string

GetCurrentChecksum extracts the current checksum from the operation

func (*SentinelChecker) SetSentinelMetadata

func (sc *SentinelChecker) SetSentinelMetadata(status *types.FileStatus, result *CheckSentinelResult, pack string)

SetSentinelMetadata sets sentinel-related metadata on the status

type SymlinkCheckResult

type SymlinkCheckResult struct {
	Exists       bool
	IsSymlink    bool
	ActualTarget string
	ModTime      time.Time
}

SymlinkCheckResult contains the result of checking a symlink

type SymlinkChecker

type SymlinkChecker struct {
	*BaseChecker
}

SymlinkChecker checks the status of symlink operations

func NewSymlinkChecker

func NewSymlinkChecker() *SymlinkChecker

NewSymlinkChecker creates a new symlink status checker

func (*SymlinkChecker) CheckStatus

CheckStatus checks if a symlink exists and points to the correct target

Jump to

Keyboard shortcuts

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