core

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ListVisible   = 0
	ListInventory = 1
)
View Source
const (
	DirectionNone  = 0
	DirectionLeft  = -1
	DirectionRight = 1
)

Directions for the lock pump mechanism

Variables

This section is empty.

Functions

func CalculateNextProfileIndex added in v0.2.7

func CalculateNextProfileIndex(currentIndex, direction, totalProfiles int) int

CalculateNextProfileIndex determines the next profile index based on direction and wrapping. direction should be 1 (next) or -1 (previous).

func FindCommandByName

func FindCommandByName(cfg config.Config, name string) (parent *config.Command, item *config.CommandItem, ok bool)

FindCommandByName returns a pointer to the matching top-level command or a nested item. If an item is returned, the parent command is also returned.

func FindFirstPopulatedRow added in v0.2.7

func FindFirstPopulatedRow(grid [][]string, col int) int

FindFirstPopulatedRow returns the index of the first row in the specified column that has content.

func FindLastPopulatedCol added in v0.2.7

func FindLastPopulatedCol(grid [][]string) int

FindLastPopulatedCol returns the index of the last column that has any content in any row.

func FindLastPopulatedRow added in v0.2.7

func FindLastPopulatedRow(grid [][]string, col int) int

FindLastPopulatedRow returns the index of the last row in the specified column that has content.

func FormatTraffic

func FormatTraffic(bps float64) string

func PrepareEnv

func PrepareEnv(env []string, whitelist []string) []string

PrepareEnv returns the environment variables to use for command execution. If whitelist is empty, it returns the original environment (pass-through). If whitelist is set, it returns only the variables that match the whitelist.

func PumpDirectionForKey added in v0.2.7

func PumpDirectionForKey(key string) int

PumpDirectionForKey returns the direction associated with a given key press. Returns DirectionLeft for 'left', 'h', 'a'. Returns DirectionRight for 'right', 'l', 'd'. Returns DirectionNone (0) for any other key.

func RotateLogIfNeeded added in v0.2.9

func RotateLogIfNeeded(path string, maxBytes int64)

RotateLogIfNeeded checks if the log file at path exceeds maxBytes. If it does, it renames the file to path + ".old" (overwriting any previous backup).

func RunCommand

func RunCommand(cfg config.Config, selected string)

RunCommand finds the selected command from the loaded config and executes it.

Types

type InventoryState added in v0.2.7

type InventoryState struct {
	Visible   []string
	Inventory []string
	HeldItem  *string
}

InventoryState manages the state of profiles in the application.

func NewInventoryState added in v0.2.7

func NewInventoryState(visible, inventory []string) *InventoryState

NewInventoryState creates a new state with copies of the provided lists.

func (*InventoryState) CalculateMoves added in v0.2.7

func (s *InventoryState) CalculateMoves(configDir string, originalVisible, originalInventory []string) (map[string]string, error)

CalculateMoves determines the file operations needed to transition from the original state to current state. Returns a map of source paths to destination paths. configDir is the root directory; inventoryDir is handled internally.

func (*InventoryState) GetList added in v0.2.7

func (s *InventoryState) GetList(listID int) (*[]string, error)

GetList returns a pointer to the slice for the given list ID.

func (*InventoryState) PickUpItem added in v0.2.7

func (s *InventoryState) PickUpItem(listID, index int) error

PickUpItem removes the item at the given index from the source list and holds it. Returns error if an item is already held or index is invalid.

func (*InventoryState) PlaceItem added in v0.2.7

func (s *InventoryState) PlaceItem(listID, index int) error

PlaceItem inserts the held item into the destination list at the given index. Returns error if no item is held.

type NetworkStatus

type NetworkStatus struct {
	Online   bool
	Counters gopsutil_net.IOCountersStat
	Time     time.Time
	Err      error
}

func CheckNetworkStatus

func CheckNetworkStatus() NetworkStatus

Jump to

Keyboard shortcuts

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