utils

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApproxDaysInYear  = 365
	ApproxDaysInMonth = 28
	DaysInWeek        = 7
)

Variables

This section is empty.

Functions

func BoolPtr

func BoolPtr(b bool) *bool

func Clamp

func Clamp(mn, wanted, mx int) int

func GetStylePrefix

func GetStylePrefix(s lipgloss.Style) string

GetStylePrefix extracts ANSI codes from a lipgloss style without the trailing reset. This allows styled text to be concatenated without breaking parent background colors.

func IntPtr

func IntPtr(u int) *int

func Max

func Max(a, b int) int

func Min

func Min(a, b int) int

func ParseDuration

func ParseDuration(s string) (time.Duration, error)

ParseDuration parses a duration string. examples: "10d", "-1.5w" or "3Y4M5d". Add time units are "d"="D", "w"="W", "mo=M", "y"="Y".

func RemoveLastReset

func RemoveLastReset(s string) string

Remove last ANSI reset code

func RemoveReset

func RemoveReset(s string) string

Remove all ANSI reset codes

func ShortNumber

func ShortNumber(n int) string

func StringPtr

func StringPtr(s string) *string

func TimeElapsed

func TimeElapsed(then time.Time) string

func UintPtr

func UintPtr(u uint) *uint

Types

type TemplateRegistry

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

func NewRegistry

func NewRegistry() *TemplateRegistry

func (*TemplateRegistry) LinkHandler

func (or *TemplateRegistry) LinkHandler(fh sprout.Handler) error

func (*TemplateRegistry) NowModify

func (or *TemplateRegistry) NowModify(input string) (string, error)

func (*TemplateRegistry) RegisterAliases

func (or *TemplateRegistry) RegisterAliases(aliasMap sprout.FunctionAliasMap) error

func (*TemplateRegistry) RegisterFunctions

func (or *TemplateRegistry) RegisterFunctions(funcsMap sprout.FunctionMap) error

func (*TemplateRegistry) UID

func (or *TemplateRegistry) UID() string

Jump to

Keyboard shortcuts

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