Documentation
¶
Index ¶
- Constants
- func CalculateNextProfileIndex(currentIndex, direction, totalProfiles int) int
- func FindCommandByName(cfg config.Config, name string) (parent *config.Command, item *config.CommandItem, ok bool)
- func FindFirstPopulatedRow(grid [][]string, col int) int
- func FindLastPopulatedCol(grid [][]string) int
- func FindLastPopulatedRow(grid [][]string, col int) int
- func FormatTraffic(bps float64) string
- func PrepareEnv(env []string, whitelist []string) []string
- func PumpDirectionForKey(key string) int
- func RotateLogIfNeeded(path string, maxBytes int64)
- func RunCommand(cfg config.Config, selected string)
- type InventoryState
- func (s *InventoryState) CalculateMoves(configDir string, originalVisible, originalInventory []string) (map[string]string, error)
- func (s *InventoryState) GetList(listID int) (*[]string, error)
- func (s *InventoryState) PickUpItem(listID, index int) error
- func (s *InventoryState) PlaceItem(listID, index int) error
- type NetworkStatus
Constants ¶
const ( ListVisible = 0 ListInventory = 1 )
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
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
FindFirstPopulatedRow returns the index of the first row in the specified column that has content.
func FindLastPopulatedCol ¶ added in v0.2.7
FindLastPopulatedCol returns the index of the last column that has any content in any row.
func FindLastPopulatedRow ¶ added in v0.2.7
FindLastPopulatedRow returns the index of the last row in the specified column that has content.
func FormatTraffic ¶
func PrepareEnv ¶
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
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
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 ¶
RunCommand finds the selected command from the loaded config and executes it.
Types ¶
type InventoryState ¶ added in v0.2.7
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