util

package
v2.4.7 Latest Latest
Warning

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

Go to latest
Published: May 12, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Theme = func() *huh.Theme {
		t := huh.ThemeBase16()
		t.Focused.FocusedButton = t.Focused.FocusedButton.Foreground(lipgloss.Color("7")).Background(lipgloss.Color("4"))
		t.Focused.TextInput.Cursor.Foreground(lipgloss.Color("4"))
		return t
	}()

	Accented = func(text string) string {
		return Theme.Focused.Title.Render(text)
	}
	Dimmed = func(text string) string {
		return Theme.Focused.Description.Render(text)
	}

	Fg              = lipgloss.AdaptiveColor{Light: "235", Dark: "252"}
	FormBaseStyle   = Theme.Form.Base.Foreground(Fg).Padding(0, 1)
	FormHeaderStyle = FormBaseStyle.Bold(true)
)

Functions

func CopyFile

func CopyFile(src, dest string) error

Safely copy a file across filesystems, preserving permissions

func CreateTable

func CreateTable() *table.Table

func EllipsizeTo

func EllipsizeTo(str string, maxLength int) string

func ExtractSubdomain added in v2.4.6

func ExtractSubdomain(url string) string

func HashString

func HashString(str string) (string, error)

func MapStrings

func MapStrings(strs []string, fn func(string) string) []string

func MoveDir

func MoveDir(src, dest string) error

Safely move a directory across filesystems, preserving permissions

func PrintJSON

func PrintJSON(obj any)

func URLSafeName

func URLSafeName(projectURL string) (string, error)

func UseTempPath

func UseTempPath(permanentPath string) (string, func() error, func() error)

Provides a temporary path, a function to relocate it to a permanent path, and a function to clean up the temporary path that should always be deferred in the case of a failure to relocate.

func WrapToLines

func WrapToLines(input string, maxLineLength int) []string

func WrapWith

func WrapWith(wrap string) func(string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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