util

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 16 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package util provides some utility functions specific to this application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeFileExt

func ChangeFileExt(filePath string, newExt string) string

ChangeFileExt changes the file extension of the given file path to the given new extension.

func ConvColorToHex

func ConvColorToHex(c color.Color) string

ConvColorToHex converts color.Color to hex string.

func FormatLightState

func FormatLightState(st blink1.LightState) string

FormatLightState in terminal-friendly style prints blink(1) light state.

func FormatLogo(content string, output io.Writer) string

FormatLogo retains the established RoseWater palette and line spacing while selecting color for the writer that will receive it.

func FormatNamedColor

func FormatNamedColor(c color.Color) string

FormatNamedColor in terminal-friendly style prints color block and its hex, and if the color's name is known, it is also included. It uses the muesli/termenv to format the string with the appropriate escape codes.

func JoinWrapSlice

func JoinWrapSlice(elems []string, separator string, maxLen int) string

JoinWrapSlice joins the given slice of strings with the given separator and wraps the result string to multiple lines if it exceeds the given maxLen.

func NormalizeQuery

func NormalizeQuery(raw ...string) string

NormalizeQuery joins arguments while preserving original case and Unicode.

func OutputColorProfile added in v0.1.1

func OutputColorProfile(output io.Writer) termenv.Profile

OutputColorProfile selects color for the actual destination without querying terminal input or its background. Any nonempty NO_COLOR wins; CLICOLOR_FORCE uses Go boolean values such as 1/true, consistently with Fang's profile policy.

func PrintDeviceList

func PrintDeviceList(dis []*se.DeviceDetail) error

PrintDeviceList prints a list of devices to stdout in table format.

func PrintDeviceListWithFirmware

func PrintDeviceListWithFirmware(dis []*se.DeviceDetail) error

PrintDeviceListWithFirmware prints a list of devices with firmware version to stdout in table format.

func PrintPatternSet

func PrintPatternSet(ps *se.PatternSet) error

PrintPatternSet prints a pattern set to stdout in table format.

func PrintStateSequence

func PrintStateSequence(seq blink1.StateSequence) error

PrintStateSequence prints a state sequence to stdout in table format.

func SetLog

func SetLog(l *zap.SugaredLogger)

SetLog sets the logger from outside the package.

func SplitConfigKey

func SplitConfigKey(key string) (k1 string, kr string)

SplitConfigKey splits the given config key into two parts: the first part is the top-level key, the second part is the rest.

Types

This section is empty.

Jump to

Keyboard shortcuts

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