number

package
v0.1.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager manages multiple number trackers

func NewManager

func NewManager() *Manager

NewManager creates a new tracker manager

func (*Manager) Add

func (m *Manager) Add(name string, current, max int) *Tracker

Add adds a new tracker

func (*Manager) Count

func (m *Manager) Count() int

Count returns the total number of trackers

func (*Manager) Delete

func (m *Manager) Delete(name string) error

Delete removes a tracker by name (case-insensitive)

func (*Manager) DeleteAll

func (m *Manager) DeleteAll()

DeleteAll removes all trackers

func (*Manager) Get

func (m *Manager) Get(name string) *Tracker

Get retrieves a tracker by name (case-insensitive)

func (*Manager) GetPinned

func (m *Manager) GetPinned() []*Tracker

GetPinned returns all pinned trackers sorted by name

func (*Manager) List

func (m *Manager) List() []*Tracker

List returns all trackers sorted by name

func (*Manager) PinAll

func (m *Manager) PinAll() int

PinAll pins all unpinned trackers

func (*Manager) PinnedCount

func (m *Manager) PinnedCount() int

PinnedCount returns the number of pinned trackers

func (*Manager) Search

func (m *Manager) Search(pattern string) []*Tracker

Search finds trackers whose names contain the search pattern (case-insensitive)

type Tracker

type Tracker struct {
	ID      string
	Name    string
	Current int
	Max     int
	Pinned  bool
}

Tracker represents a number tracker (e.g., HP, AC, etc.)

func NewTracker

func NewTracker(name string, current, max int) *Tracker

NewTracker creates a new number tracker

func (*Tracker) Adjust

func (t *Tracker) Adjust(delta int)

Adjust adjusts the current value by a delta (can be positive or negative)

func (*Tracker) Pin

func (t *Tracker) Pin()

Pin pins the tracker to display

func (*Tracker) Set

func (t *Tracker) Set(value int)

Set sets the current value

func (*Tracker) String

func (t *Tracker) String() string

String returns a string representation of the tracker

func (*Tracker) Unpin

func (t *Tracker) Unpin()

Unpin unpins the tracker from display

Jump to

Keyboard shortcuts

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