charmutils

package module
v0.0.0-...-242a99f Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: MIT Imports: 13 Imported by: 0

README

Charm Utils

A collection of utilities for working with the Charm ecosystem. See the GoDocs for more details.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidTypeAssertion = errors.New("invalid type assertion")
)

Functions

func ConstructKeyBinding

func ConstructKeyBinding(keys []string, desc string) key.Binding

ConstructKeyBinding creates a new binding with the given keys and a help message with the description and each of the keys.

func HuhIntRangeOptions

func HuhIntRangeOptions(lower, upper int) []huh.Option[int]

HuhIntRangeOptions creates a new slice of integer options using the lower and upper bound (inclusive).

func Overlay

func Overlay(bg, overlay string, row, col int, ignoreMarginWhitespace bool) (string, error)

Overlay writes the overlay string onto the background string at the specified row and column. In this case, the row and column are zero indexed.

func OverlayCenter

func OverlayCenter(bg string, overlay string, ignoreMarginWhitespace bool) (string, error)

OverlayCenter writes the overlay string onto the background string such that the middle of the overlay string will be at the middle of the overlay will be at the middle of the background.

func UpdateTypedModel

func UpdateTypedModel[T tea.Model](model *T, msg tea.Msg) (tea.Cmd, error)

UpdateTypedModel performs an update on the model using the given msg. This enables easily storing models of a concrete type without having the clutter of frequent type assertions.

Types

This section is empty.

Jump to

Keyboard shortcuts

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